Skip to content

Commit

Permalink
feat: Use git hash of latest change to src/schema
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Aug 26, 2024
1 parent 9eeab01 commit 6ba6974
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/publish_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
filter: "blob:none"
- uses: actions/setup-python@v5
with:
python-version: 3
Expand All @@ -36,7 +39,6 @@ jobs:
git clean -fxd tools/schemacode
- name: Checkout jsr-dist
run: |
git fetch --depth=1 origin jsr-dist
git checkout -t origin/jsr-dist
- name: Regenerate schema
run: bst export > schema.json
Expand All @@ -59,8 +61,8 @@ jobs:
jq ".version = \"$VERSION\"" jsr.json > tmp.json && mv tmp.json jsr.json
else
DENOVER=$( jq -r .version jsr.json )
# Should switch to using the commit hash of the source repo?
HASH=$( sha256sum schema.json | head -c 7 )
# Get the reference of the latest commit to touch the schema directory
HASH=$( git log -n 1 --pretty=%h $REF -- src/schema )
if [[ $DENOVER =~ ^"$BASE".[0-9] ]]; then
PREFIX=${DENOVER%+*}
let SERIAL=1+${PREFIX#$BASE.}
Expand All @@ -70,6 +72,8 @@ jobs:
VERSION="$BASE.$SERIAL+$HASH"
fi
echo VERSION=$VERSION | tee -a $GITHUB_ENV
env:
REF: ${{ github.ref }}
- name: Check for changes, set version and commit
run: |
if ! git diff -s --exit-code; then
Expand Down

0 comments on commit 6ba6974

Please sign in to comment.