Skip to content

Commit 2f24776

Browse files
authored
Merge pull request #13082 from quarto-dev/gha/prevent-rerun
[create release] Add a step in each jobs to prevent re-running the job
2 parents 2822eba + c4f8e0c commit 2f24776

File tree

2 files changed

+93
-7
lines changed

2 files changed

+93
-7
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Prevent Workflow Re-run
2+
description: Fails if the workflow is re-run (github.run_attempt > 1)
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Prevent any re-run
7+
if: ${{ github.run_attempt > 1 }}
8+
run: |
9+
echo "::error::Re-running jobs is not permitted. Please trigger a new build manually at https://github.com/quarto-dev/quarto-cli/actions/workflows/create-release.yml (click 'Run workflow'), or use the GitHub CLI: 'gh workflow run create-release.yml'"
10+
exit 1
11+
shell: bash

.github/workflows/create-release.yml

Lines changed: 82 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,17 @@ jobs:
2828
tag_name: v${{ steps.read-version.outputs.version_full }}
2929
version_commit: ${{ steps.version_commit.outputs.commit_long_sha }}
3030
pushed: ${{ steps.version_commit.outputs.pushed }}
31+
tagged: ${{ steps.version_commit.outputs.tagged }}
3132
tag_pushed: ${{ steps.version_commit.outputs.tag_pushed }}
3233
if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository == 'quarto-dev/quarto-cli')
3334
steps:
3435
- uses: actions/checkout@v4
3536
with:
3637
fetch-depth: 0
3738

39+
- name: Prevent Re-run
40+
uses: ./.github/workflows/actions/prevent-rerun
41+
3842
# we _also_ need npm, specifically for webui/preview
3943
- uses: actions/setup-node@v4
4044
with:
@@ -99,6 +103,9 @@ jobs:
99103
with:
100104
ref: ${{ needs.configure.outputs.version_commit }}
101105

106+
- name: Prevent Re-run
107+
uses: ./.github/workflows/actions/prevent-rerun
108+
102109
- name: Make Tarball
103110
run: |
104111
tar --owner=root --group=root -zcvf quarto-${{needs.configure.outputs.version}}.tar.gz *
@@ -117,6 +124,9 @@ jobs:
117124
with:
118125
ref: ${{ needs.configure.outputs.version_commit }}
119126

127+
- name: Prevent Re-run
128+
uses: ./.github/workflows/actions/prevent-rerun
129+
120130
- name: Configure
121131
run: |
122132
./configure.sh
@@ -150,6 +160,9 @@ jobs:
150160
with:
151161
ref: ${{ needs.configure.outputs.version_commit }}
152162

163+
- name: Prevent Re-run
164+
uses: ./.github/workflows/actions/prevent-rerun
165+
153166
- name: Configure
154167
run: |
155168
./configure.sh
@@ -183,6 +196,9 @@ jobs:
183196
with:
184197
ref: ${{ needs.configure.outputs.version_commit }}
185198

199+
- name: Prevent Re-run
200+
uses: ./.github/workflows/actions/prevent-rerun
201+
186202
- name: Configure
187203
run: |
188204
./configure.sh
@@ -227,6 +243,9 @@ jobs:
227243
with:
228244
ref: ${{ needs.configure.outputs.version_commit }}
229245

246+
- name: Prevent Re-run
247+
uses: ./.github/workflows/actions/prevent-rerun
248+
230249
- name: Configure
231250
run: |
232251
./configure.sh
@@ -257,6 +276,9 @@ jobs:
257276
with:
258277
ref: ${{ needs.configure.outputs.version_commit }}
259278

279+
- name: Prevent Re-run
280+
uses: ./.github/workflows/actions/prevent-rerun
281+
260282
- name: Configure
261283
run: |
262284
./configure.sh
@@ -283,6 +305,15 @@ jobs:
283305
runs-on: ubuntu-latest
284306
needs: [configure, make-tarball]
285307
steps:
308+
- uses: actions/checkout@v4
309+
with:
310+
ref: ${{ needs.configure.outputs.version_commit }}
311+
sparse-checkout: |
312+
.github
313+
314+
- name: Prevent Re-run
315+
uses: ./.github/workflows/actions/prevent-rerun
316+
286317
- uses: actions/download-artifact@v4
287318
with:
288319
name: Deb Zip
@@ -303,15 +334,17 @@ jobs:
303334
needs: [configure]
304335

305336
steps:
306-
- name: Configure Rust Tools
307-
run: |
308-
rustup.exe toolchain install 1.63.0 --component rustfmt --component clippy --no-self-update
309-
rustup.exe default 1.63.0
310-
311337
- uses: actions/checkout@v4
312338
with:
313339
ref: ${{ needs.configure.outputs.version_commit }}
314340

341+
- name: Prevent Re-run
342+
uses: ./.github/workflows/actions/prevent-rerun
343+
344+
- name: Configure Rust Tools
345+
run: |
346+
rustup.exe toolchain install 1.63.0 --component rustfmt --component clippy --no-self-update
347+
rustup.exe default 1.63.0
315348
- name: Configure
316349
run: |
317350
.\configure.cmd
@@ -383,6 +416,15 @@ jobs:
383416
runs-on: windows-latest
384417
needs: [configure, make-installer-win]
385418
steps:
419+
- uses: actions/checkout@v4
420+
with:
421+
ref: ${{ needs.configure.outputs.version_commit }}
422+
sparse-checkout: |
423+
.github
424+
425+
- name: Prevent Re-run
426+
uses: ./.github/workflows/actions/prevent-rerun
427+
386428
- uses: actions/download-artifact@v4
387429
with:
388430
name: Windows Zip
@@ -403,6 +445,9 @@ jobs:
403445
with:
404446
ref: ${{ needs.configure.outputs.version_commit }}
405447

448+
- name: Prevent Re-run
449+
uses: ./.github/workflows/actions/prevent-rerun
450+
406451
- name: Configure
407452
run: |
408453
./configure.sh
@@ -464,6 +509,15 @@ jobs:
464509
runs-on: macos-latest
465510
needs: [configure, make-installer-mac]
466511
steps:
512+
- uses: actions/checkout@v4
513+
with:
514+
ref: ${{ needs.configure.outputs.version_commit }}
515+
sparse-checkout: |
516+
.github
517+
518+
- name: Prevent Re-run
519+
uses: ./.github/workflows/actions/prevent-rerun
520+
467521
- uses: actions/download-artifact@v4
468522
with:
469523
name: Mac Zip
@@ -499,6 +553,16 @@ jobs:
499553
]
500554

501555
steps:
556+
- uses: actions/checkout@v4
557+
with:
558+
ref: ${{ needs.configure.outputs.version_commit }}
559+
path: quarto-cli
560+
sparse-checkout: |
561+
.github
562+
563+
- name: Prevent Re-run
564+
uses: ./quarto-cli/.github/workflows/actions/prevent-rerun
565+
502566
- name: Download Artifacts
503567
uses: actions/download-artifact@v4
504568

@@ -601,6 +665,9 @@ jobs:
601665
steps:
602666
- uses: actions/checkout@v4
603667

668+
- name: Prevent Re-run
669+
uses: ./.github/workflows/actions/prevent-rerun
670+
604671
- name: Revert commit of version.txt
605672
if: ${{ needs.configure.outputs.pushed }}
606673
run: |
@@ -614,7 +681,7 @@ jobs:
614681
git push origin $GITHUB_REF_NAME
615682
616683
- name: Deleted created tag
617-
if: ${{ needs.configure.outputs.tag_pushed }}
684+
if: ${{ needs.configure.outputs.tagged && needs.configure.outputs.tag_pushed }}
618685
run: |
619686
git push --delete origin ${{ needs.configure.outputs.tag_name }}
620687
@@ -623,10 +690,18 @@ jobs:
623690
runs-on: ubuntu-latest
624691
needs: [configure, publish-release]
625692
steps:
693+
- uses: actions/checkout@v4
694+
with:
695+
sparse-checkout: |
696+
.github
697+
698+
- name: Prevent Re-run
699+
uses: ./.github/workflows/actions/prevent-rerun
700+
626701
- name: Download Artifacts
627702
uses: actions/download-artifact@v4
628703

629-
- uses: quarto-dev/quarto-cli/.github/actions/docker@main
704+
- uses: ./.github/actions/docker
630705
with:
631706
source: ./Deb Installer/quarto-${{needs.configure.outputs.version}}-linux-amd64.deb
632707
version: ${{needs.configure.outputs.version}}

0 commit comments

Comments
 (0)