Update Downloads #101096
This file contains 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.cherry-pick-prerelease.outputs.commit_hash }} | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
# 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: Commit Changes to main branch | |
id: auto-commit | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
repository: . | |
commit_user_name: Github Action Runner | |
commit_user_email: [email protected] | |
commit_author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | |
skip_checkout: true | |
- name: Cherry-pick change to prerelease branch | |
id: cherry-pick-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' | |
git checkout prerelease | |
git cherry-pick ${{ steps.auto-commit.outputs.commit_hash }} | |
git push origin prerelease | |
# set an output for github action with the resulted commit of cherry-pick command | |
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 |