Publish Versions to GitHub Pages #51
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: Publish Versions to GitHub Pages | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - "master" | |
| paths-ignore: | |
| - '.gitignore' | |
| - 'LICENSE' | |
| - 'README.md' | |
| schedule: | |
| - cron: '0 0 * * *' # Every day at midnight UTC | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| - name: Get latest release information for Broadcaster | |
| id: broadcaster-release | |
| uses: octokit/[email protected] | |
| with: | |
| route: GET /repos/MCXboxBroadcast/Broadcaster/releases/latest | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.WORKFLOW_PAT }} | |
| - name: Get commit SHA for Broadcaster tag | |
| id: broadcaster-commit | |
| uses: octokit/[email protected] | |
| with: | |
| route: GET /repos/MCXboxBroadcast/Broadcaster/git/ref/tags/${{ fromJson(steps.broadcaster-release.outputs.data).tag_name }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.WORKFLOW_PAT }} | |
| - name: Get latest release information for Manager | |
| id: manager-release | |
| uses: octokit/[email protected] | |
| with: | |
| route: GET /repos/MCXboxBroadcast/Manager/releases/latest | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.WORKFLOW_PAT }} | |
| - name: Get commit SHA for Manager tag | |
| id: manager-commit | |
| uses: octokit/[email protected] | |
| with: | |
| route: GET /repos/MCXboxBroadcast/Manager/git/ref/tags/${{ fromJson(steps.manager-release.outputs.data).tag_name }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.WORKFLOW_PAT }} | |
| - name: Create versions.json | |
| run: | | |
| BROADCASTER_BUILD="${{ fromJson(steps.broadcaster-release.outputs.data).tag_name }}" | |
| BROADCASTER_COMMIT="${{ fromJson(steps.broadcaster-commit.outputs.data).object.sha }}" | |
| MANAGER_BUILD="${{ fromJson(steps.manager-release.outputs.data).tag_name }}" | |
| MANAGER_COMMIT="${{ fromJson(steps.manager-commit.outputs.data).object.sha }}" | |
| mkdir -p out | |
| echo '{ | |
| "broadcaster": { | |
| "build": "'$BROADCASTER_BUILD'", | |
| "commit": "'$BROADCASTER_COMMIT'" | |
| }, | |
| "manager": { | |
| "build": "'$MANAGER_BUILD'", | |
| "commit": "'$MANAGER_COMMIT'" | |
| } | |
| }' | jq -c > out/versions.json | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./out | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |