deploy #151
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: deploy | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| on: | |
| workflow_run: | |
| workflows: [build] | |
| types: | |
| - completed | |
| jobs: | |
| deploy: | |
| if: | | |
| github.event.workflow_run.conclusion == 'success' && | |
| github.event.workflow_run.event == 'push' && | |
| github.repository == 'jellyfin/jellyfin.org' | |
| name: Deploy to GitHub Pages | |
| permissions: | |
| actions: read | |
| pages: write | |
| id-token: write | |
| concurrency: build-deploy-pages | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download workflow artifact | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| GH_REPO: ${{ github.repository }} | |
| RUN_ID: ${{ github.event.workflow_run.id }} | |
| run: gh run download "$RUN_ID" -n jellyfin-org__build -D build | |
| - name: Configure Pages | |
| uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0 | |
| - name: Create pages artifact | |
| run: tar --dereference --hard-dereference --directory build -cvf "$RUNNER_TEMP/artifact.tar" --exclude=.git --exclude=.github . | |
| - name: Upload pages artifact | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: github-pages | |
| path: ${{ runner.temp }}/artifact.tar | |
| retention-days: 1 | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0 | |
| publish: | |
| if: | | |
| github.event.workflow_run.conclusion == 'success' && | |
| github.event.workflow_run.event == 'pull_request' && | |
| github.event.workflow_run.pull_requests && | |
| github.repository == 'jellyfin/jellyfin.org' | |
| name: Deploy to Cloudflare Pages | |
| permissions: | |
| actions: read | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Set PR metadata | |
| id: pr | |
| run: | | |
| echo "number=${{ github.event.workflow_run.pull_requests[0].number }}" >> $GITHUB_OUTPUT | |
| echo "sha=${{ github.event.workflow_run.head_sha }}" >> $GITHUB_OUTPUT | |
| - name: Add comment | |
| uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1 | |
| with: | |
| github-token: ${{ secrets.JF_BOT_TOKEN }} | |
| message: | | |
| ## Cloudflare Pages deployment | |
| | **Latest commit** | <code>${{ steps.pr.outputs.sha }}</code> | | |
| |-------------------|:-:| | |
| | **Status** | 🔄 Deploying... | | |
| | **Preview URL** | Not available | | |
| | **Type** | 🔀 Preview | | |
| pr-number: ${{ steps.pr.outputs.number }} | |
| comment-tag: CFPages-deployment | |
| mode: recreate | |
| - name: Download workflow artifact | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| GH_REPO: ${{ github.repository }} | |
| RUN_ID: ${{ github.event.workflow_run.id }} | |
| run: gh run download "$RUN_ID" -n jellyfin-org__build -D build | |
| - name: Publish to Cloudflare | |
| id: cf | |
| uses: cloudflare/wrangler-action@9acf94ace14e7dc412b076f2c5c20b8ce93c79cd # v3.15.0 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| command: > | |
| pages deploy build | |
| --project-name=jellyfin-org | |
| --branch=${{ (github.event.workflow_run.event != 'pull_request' | |
| || github.event.workflow_run.head_repository.full_name == github.repository) | |
| && github.event.workflow_run.head_branch | |
| || format( | |
| '{0}/{1}', | |
| github.event.workflow_run.head_repository.full_name, | |
| github.event.workflow_run.head_branch) | |
| }} | |
| --commit-hash=${{ steps.pr.outputs.sha }} | |
| - name: Update status comment | |
| uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1 | |
| with: | |
| github-token: ${{ secrets.JF_BOT_TOKEN }} | |
| message: | | |
| ## Cloudflare Pages deployment | |
| | **Latest commit** | <code>${{ steps.pr.outputs.sha }}</code> | | |
| |-------------------|:-:| | |
| | **Status** | ${{ job.status == 'success' && '✅ Deployed!' || '❌ Failed!' }} | | |
| | **Preview URL** | ${{ steps.cf.outputs.deployment-url || 'Not available' }} | | |
| | **Type** | 🔀 Preview | | |
| pr-number: ${{ steps.pr.outputs.number }} | |
| comment-tag: CFPages-deployment | |
| mode: recreate |