Update Downloads #144250
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
| # Regenerates the download json | |
| name: Update Downloads | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "*/15 * * * *" | |
| jobs: | |
| update-downloads: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| changes_detected: ${{ steps.auto-commit.outputs.changes_detected }} | |
| commit: ${{ steps.auto-commit.outputs.commit_hash }} | |
| commit_prerelease: ${{ steps.sync-prerelease.outputs.commit_hash }} | |
| prerelease_version: ${{ steps.get-versions.outputs.prerelease_version }} | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v6 | |
| # with: | |
| # token: ${{ secrets.COMMIT_PAT }} | |
| - name: Regenerate Download Json | |
| uses: ./.github/workflows/actions/release-info | |
| with: | |
| owner: 'quarto-dev' | |
| repo: 'quarto-cli' | |
| out-path: 'docs/download/' | |
| redirects-path: '_redirects' | |
| redirects-template: /download/latest/$$prefix$$-$$suffix$$.$$extension$$ | |
| pre-redirects-template: /download/prerelease/$$prefix$$-$$suffix$$.$$extension$$ | |
| github-token: ${{ github.token }} | |
| - name: Get versions from generated JSON | |
| id: get-versions | |
| run: | | |
| prerelease_version=$(jq -r '.version' docs/download/_prerelease.json) | |
| echo "prerelease_version=$prerelease_version" >> "$GITHUB_OUTPUT" | |
| echo "Prerelease version: $prerelease_version" | |
| - name: Commit Changes to main branch | |
| id: auto-commit | |
| uses: stefanzweifel/git-auto-commit-action@v7 | |
| with: | |
| repository: . | |
| commit_user_name: Github Action Runner | |
| commit_user_email: runner@quarto.org | |
| commit_author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | |
| - name: Sync generated downloads to prerelease branch | |
| id: sync-prerelease | |
| if: ${{ steps.auto-commit.outputs.changes_detected == 'true' }} | |
| run: | | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
| MAIN_SHA=${{ steps.auto-commit.outputs.commit_hash }} | |
| git checkout prerelease | |
| # _redirects is authoritative on main (manual redirects reach prerelease | |
| # via the backport workflow), so overwrite the generated files outright | |
| # instead of cherry-picking — never conflicts. | |
| git checkout "$MAIN_SHA" -- _redirects docs/download/_download.json docs/download/_prerelease.json | |
| if git diff --cached --quiet; then | |
| echo "No changes to sync to prerelease" | |
| else | |
| git commit -m "Sync generated download redirects from main" | |
| git push origin prerelease | |
| fi | |
| echo "commit_hash=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" | |
| # If a new commit has been made with updated downloads, | |
| # then publish the changes using the new commit as ref to checkout | |
| # in the reusable publish workflow | |
| publish-changes-release: | |
| needs: [ update-downloads ] | |
| if: ${{ needs.update-downloads.outputs.changes_detected == 'true' }} | |
| uses: ./.github/workflows/publish.yml | |
| with: | |
| ref: ${{ needs.update-downloads.outputs.commit }} | |
| prerelease: false | |
| secrets: inherit | |
| # If a new commit has been made with updated downloads, | |
| # then publish the changes using the new commit as ref to checkout | |
| # in the reusable publish workflow | |
| publish-changes-prerelease: | |
| needs: [ update-downloads ] | |
| if: ${{ needs.update-downloads.outputs.changes_detected == 'true' }} | |
| uses: ./.github/workflows/publish.yml | |
| with: | |
| ref: ${{ needs.update-downloads.outputs.commit_prerelease }} | |
| prerelease: true | |
| secrets: inherit | |
| # If a new commit has been made with updated downloads, | |
| # trigger the reference page update workflow | |
| update-prerelease-reference: | |
| needs: [ update-downloads ] | |
| if: ${{ needs.update-downloads.outputs.changes_detected == 'true' }} | |
| uses: ./.github/workflows/update-prerelease-reference.yml | |
| with: | |
| version: ${{ needs.update-downloads.outputs.prerelease_version }} | |
| secrets: inherit |