Release #34
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| emby_version: | |
| description: "The Emby server version for this release (e.g., 4.8.11.0)." | |
| type: string | |
| required: true | |
| default: 4.8.11.0 | |
| your_mb3admin_replacement_url: | |
| description: >- | |
| URL for Emby's server replacement. Must starts with 'http' and end with a '/'. | |
| type: string | |
| required: true | |
| default: https://mb3admin.megm.workers.dev/ | |
| remote_debug: | |
| description: >- | |
| Starts an SSH session to debug the runner. For advanced troubleshooting only. | |
| type: boolean | |
| required: false | |
| default: false | |
| publish: # New input for publishing | |
| description: "Publish to GitHub Release and create a tag (as a draft first)" | |
| type: boolean | |
| required: false | |
| default: false | |
| jobs: | |
| build: # This job will now handle both build and conditional release | |
| runs-on: ubuntu-latest | |
| env: | |
| EMBY_REPLACEMENT_URL: ${{ inputs.your_mb3admin_replacement_url }} | |
| EMBY_VERSION: ${{ inputs.emby_version }} | |
| permissions: # Permissions needed for creating releases and tags in this job | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # with: | |
| # fetch-depth: 0 # Fetch all history for tag creation, needed for git tag | |
| - uses: pnpm/action-setup@v4 | |
| name: Install pnpm | |
| with: | |
| version: 10 | |
| run_install: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| registry-url: https://registry.npmjs.org/ | |
| - name: Install Task | |
| uses: arduino/setup-task@v2 | |
| with: | |
| version: 3.44.0 | |
| - name: Verify environment node | |
| run: | | |
| node --version | |
| npm --version | |
| pnpm --version | |
| - name: Start debug session (when enabled) | |
| if: ${{ inputs.remote_debug }} | |
| uses: lhotari/action-upterm@v1 | |
| - name: Prepare Build Environment (via build.sh) # IMP-010: Renamed for clarity | |
| run: | | |
| ./build.sh prepare:prepare | |
| - name: Build | |
| run: | | |
| ./build.sh | |
| mv ./tmp/build/dist embyhack | |
| - name: Validate artifact | |
| run: test -d embyhack | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: docker-embyhack | |
| path: embyhack | |
| # --- Release steps, now conditional and within the 'build' job --- | |
| - name: Create zip archive for release | |
| run: zip -r docker-embyhack.zip embyhack | |
| if: ${{ inputs.publish }} # Only run if publishing | |
| - name: Get current date and time | |
| id: date | |
| if: ${{ inputs.publish }} # Only run if publishing | |
| run: echo "NOW=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT | |
| - name: Determine tag name | |
| id: set_tag | |
| if: ${{ inputs.publish }} # Only run if publishing | |
| run: | | |
| PRERELEASE_SUFFIX="" | |
| if [[ "${{ github.ref_name }}" != "main" ]]; then | |
| PRERELEASE_SUFFIX="-alpha" | |
| fi | |
| TAG_NAME="v${{ inputs.emby_version }}$PRERELEASE_SUFFIX+${{ steps.date.outputs.NOW }}" | |
| RELEASE_NAME="Release $TAG_NAME" | |
| echo "TAG_NAME=$TAG_NAME" >> $GITHUB_OUTPUT | |
| echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_OUTPUT | |
| cat <<EOF > Release.txt | |
| Automated release from GitHub Actions. | |
| Branch: ${{ github.ref_name }} | |
| Commit: ${{ github.sha }} | |
| Build Date: ${{ steps.date.outputs.NOW }} | |
| Emby Version: ${{ inputs.emby_version }}" | |
| EOF | |
| cat Release.txt > Release_body.txt | |
| echo "**This is a DRAFT release. Please verify the artifact before publishing.**" >> Release_body.txt | |
| - name: Wait until continue | |
| if: ${{ inputs.remote_debug }} | |
| run: | | |
| file_to_wait="./continue_debug" | |
| # IMP-009: Improved clarity for the user | |
| echo "Debug session started. To continue the workflow, create an empty file named '$file_to_wait' in the runner's workspace." | |
| echo "Waiting for $file_to_wait to be created..." | |
| while [ ! -f "$file_to_wait" ]; do | |
| sleep 5 # Check every 5 seconds | |
| echo "Still waiting for $file_to_wait..." | |
| done | |
| echo "$file_to_wait has been created. Proceeding with operations." | |
| - name: Create and push tag | |
| if: ${{ inputs.publish }} # Only run if publishing | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git tag ${{ steps.set_tag.outputs.TAG_NAME }} | |
| git push origin ${{ steps.set_tag.outputs.TAG_NAME }} | |
| - name: Create GitHub Release (as Draft) | |
| if: ${{ inputs.publish }} # Only run if publishing | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.set_tag.outputs.TAG_NAME }} | |
| name: ${{ steps.set_tag.outputs.RELEASE_NAME }} | |
| body_path: Release_body.txt | |
| draft: true # Set to true to create a draft release for manual verification | |
| prerelease: ${{ github.ref_name != 'main' }} # Mark as prerelease if not on main branch | |
| files: | | |
| Release.txt | |
| docker-embyhack.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GITHUB_TOKEN is automatically provided by GitHub Actions |