Skip to content

Commit 64ea631

Browse files
committed
Try passing ref for checkout for release process
Signed-off-by: Taylor Smock <smocktaylor@gmail.com>
1 parent 7776994 commit 64ea631

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

.github/workflows/release.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ on:
33
release:
44
types: [created]
55
workflow_call:
6+
inputs:
7+
ref:
8+
required: false
9+
type: string
610
workflow_dispatch:
711

812
jobs:
@@ -11,8 +15,17 @@ jobs:
1115
runs-on: ubuntu-latest
1216
permissions:
1317
contents: read
18+
outputs:
19+
ref: ${{ steps.ref_finder.outputs.ref }}
1420
steps:
21+
- name: Find ref to build/publish
22+
id: ref_finder
23+
run: |
24+
if [[ ! -z "${{ inputs.ref }} ]]; then echo "ref=${{ inputs.ref }}" >> $GITHUB_OUTPUT
25+
else echo "ref=${{ github.sha }}" >> $GITHUB_OUTPUT
1526
- uses: actions/checkout@v4
27+
with:
28+
ref: ${{ steps.ref_finder.outputs.ref }}
1629
- uses: actions/setup-python@v5
1730
with:
1831
cache: 'pip'
@@ -36,6 +49,8 @@ jobs:
3649
id-token: write
3750
steps:
3851
- uses: actions/checkout@v4
52+
with:
53+
ref: ${{ needs.build.outputs.ref }}
3954
- uses: actions/setup-node@v4
4055
with:
4156
node-version: 20
@@ -53,6 +68,8 @@ jobs:
5368
packages: write
5469
steps:
5570
- uses: actions/checkout@v4
71+
with:
72+
ref: ${{ needs.build.outputs.ref }}
5673
- uses: actions/setup-node@v4
5774
with:
5875
node-version: 20
@@ -68,5 +85,7 @@ jobs:
6885
contents: read
6986
steps:
7087
- uses: actions/checkout@v4
88+
with:
89+
ref: ${{ needs.build.outputs.ref }}
7190
- run: curl "https://www.webjars.org/deploy?webJarType=npm&nameOrUrlish=tag2link&version=$(jq -r '.version' package.json)"
7291

.github/workflows/scheduled_update.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
if [ $(git diff --name-only | wc -l) -gt 0 ]; then
3535
tag=$(jq -r '.version' package.json)
3636
# The GH api only allows for single file commits right now
37+
# https://docs.github.com/en/rest/repos/contents?apiVersion=2022-11-28#create-or-update-file-contents
3738
for file in $(git diff --name-only); do
3839
gh api --method PUT -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \
3940
"/repos/${{ github.repository }}/contents/$file" \
@@ -56,6 +57,7 @@ jobs:
5657
GH_TOKEN: ${{ github.token }}
5758
outputs:
5859
release_needed: ${{ steps.tag.outputs.release_needed }}
60+
tag: ${{ steps.tag.outputs.tag }}
5961
steps:
6062
- uses: actions/checkout@v4
6163
with:
@@ -90,6 +92,7 @@ jobs:
9092
--field "sha=${object}"
9193
gh release create ${tag} --generate-notes
9294
echo "release_needed=true" >> "$GITHUB_OUTPUT"
95+
echo "tag=${tag}" >> $GITHUB_OUTPUT
9396
else
9497
echo "release_needed=false" >> "$GITHUB_OUTPUT"
9598
fi
@@ -98,6 +101,8 @@ jobs:
98101
if: needs.tag.outputs.release_needed
99102
uses: ./.github/workflows/release.yaml
100103
secrets: inherit
104+
with:
105+
ref: ${{ needs.tag.outputs.tag }}
101106
permissions:
102107
attestations: write
103108
contents: read

0 commit comments

Comments
 (0)