-
Notifications
You must be signed in to change notification settings - Fork 850
75 lines (70 loc) · 2.88 KB
/
update-downloads.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# 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