Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add release-plz schema action run #594

Merged
merged 5 commits into from
Mar 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions .github/workflows/schemas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 📄 Schemas

on:
push:
branches: [main]
branches: [main, "release-plz-*"]
# branches: [main, "**"]

permissions:
Expand All @@ -14,6 +14,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
rust: ${{ steps.filter.outputs.rust }}
manifest: ${{ steps.filter.outputs.manifest }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
Expand All @@ -26,10 +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 @@ -58,12 +61,29 @@ jobs:
run: cargo run -p homestar-schemas

- name: Check for modified schemas
id: git-check
id: git-check-schemas
zeeshanlakhani marked this conversation as resolved.
Show resolved Hide resolved
shell: bash
run: echo modified=$(if [[ $(git diff homestar-runtime/schemas/) ]]; then echo "true"; else echo "false"; fi) >> $GITHUB_OUTPUT

- name: Push changes
if: steps.git-check.outputs.modified == 'true'
- name: Push changes to main
if: >-
${{ github.ref_name == 'main' &&
(steps.git-check-schemas.outputs.modified == 'true' &&
(needs.changes.outputs.rust == 'true' || needs.changes.outputs.manifest == 'true')
)
}}
run: |
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 to release-plz branch
if: >-
${{ startsWith(github.ref_name, 'release-plz') &&
(steps.git-check-schemas.outputs.modified == 'true' && needs.changes.outputs.manifest == 'true')
}}
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
Expand Down