Skip to content

Commit

Permalink
chore: Run release-plz on version changes only
Browse files Browse the repository at this point in the history
  • Loading branch information
bgins committed Mar 5, 2024
1 parent 8d73246 commit f37ac5d
Showing 1 changed file with 36 additions and 8 deletions.
44 changes: 36 additions & 8 deletions .github/workflows/schemas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: 📄 Schemas

on:
push:
branches: [main, "release-plz-*"]
branches: [main, "bgins/run-schemas-*"]
# branches: [main, "release-plz-*"]
# branches: [main, "**"]

permissions:
Expand All @@ -26,11 +27,12 @@ jobs:
- 'homestar-runtime/src/**'
- 'homestar-schemas/src/**'
- 'homestar-workflow/src/**'
manifest:
- 'Cargo.toml'
schemas:
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' }}
if: ${{ needs.changes.outputs.rust == 'true' || needs.changes.outputs.manifest == 'true' }}
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
Expand Down Expand Up @@ -63,14 +65,40 @@ jobs:
shell: bash
run: echo modified=$(if [[ $(git diff homestar-runtime/schemas/) ]]; then echo "true"; else echo "false"; fi) >> $GITHUB_OUTPUT

- name: Check for updated version
id: git-check-manifest
shell: bash
run: echo modified=$(if [[ $(git diff Cargo.toml) ]]; then echo "true"; else echo "false"; fi) >> $GITHUB_OUTPUT
# - name: Check for updated version
# id: git-check-manifest
# shell: bash
# run: echo modified=$(if [[ $(git diff Cargo.toml) ]]; then echo "true"; else echo "false"; fi) >> $GITHUB_OUTPUT

- name: Echo results
run: |
echo Manifest version updated:
echo ${{ needs.changes.outputs.manifest }}
echo Schemas updated:
echo ${{ steps.git-check-schemas.outputs.modified }}
echo Branch starts with bgins/run-schemas:
echo ${{ startsWith(github.ref_name, 'bgins/run-schemas') }}
echo Check main condition:
echo ${{ (github.ref_name == 'main' && (steps.git-check-schemas.outputs.modified == 'true' || steps.git-check-manifest.outputs.modified == 'true')) }}
echo Check branch condition:
echo ${{ (startsWith(github.ref_name, 'bgins/run-schemas') && steps.git-check-manifest.outputs.modified == 'true') }}
- name: Push changes to main
# if: github.ref_name == 'main' && (steps.git-check-schemas.outputs.modified == 'true' || steps.git-check-manifest.outputs.modified == 'true')
if: github.ref_name == 'main' && (steps.git-check-schemas.outputs.modified == 'true' || needs.changes.outputs.manifest == 'true')
run: |
echo RUNNING main
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
git commit -am "chore(schemas): update OpenRPC API doc and JSON schemas"
git push
- name: Push changes
if: ${{ steps.git-check-schemas.outputs.modified == 'true' || steps.git-check-manifest.outputs.modified == 'true' }}
- name: Push changes to release-plz branch
# if: startsWith(github.ref_name, 'bgins/run-schemas') && steps.git-check-manifest.outputs.modified == 'true'
if: startsWith(github.ref_name, 'bgins/run-schemas') && needs.changes.outputs.manifest == 'true'
run: |
echo RUNNING release-plz
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
Expand Down

0 comments on commit f37ac5d

Please sign in to comment.