Skip to content

Commit

Permalink
chore: More schema action tinkering part three
Browse files Browse the repository at this point in the history
  • Loading branch information
bgins committed Feb 8, 2024
1 parent 05545ab commit 7d85584
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 20 deletions.
44 changes: 26 additions & 18 deletions .github/workflows/schemas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ name: 📄 Schemas

on:
push:
# branches: [main, "**"]
branches: [main]
branches: [main, "**"]

pull_request:
branches: ["**"]
# pull_request:
# branches: ["**"]

permissions:
contents: write
Expand All @@ -15,8 +14,6 @@ permissions:
jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
rust: ${{ steps.filter.outputs.rust }}
steps:
Expand All @@ -27,20 +24,17 @@ jobs:
with:
filters: |
rust:
- '**/Cargo.*'
- '**/src/**'
- '**/tests/**'
- '**/build.rs'
- '**/migrations/**'
- '**/fixtures/**'
- '**/wit/**'
- 'homestar-invocation/src/**'
- 'homestar-runtime/src/**'
- 'homestar-schemas/src/**'
- 'homestar-workflow/src/**'
schemas:
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' }}
# env:
# SCCACHE_GHA_ENABLED: "true"
# RUSTC_WRAPPER: "sccache"
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -53,6 +47,16 @@ jobs:
- name: Install Rust Toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache Project
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
shared-key: test-all-stable-ubuntu-latest
save-if: ${{ github.event_name == 'push' }}

- name: Sccache
uses: mozilla-actions/[email protected]

- name: Run generate schemas
run: cargo run -p homestar-schemas

Expand All @@ -75,13 +79,17 @@ jobs:

- name: Check for modified files
id: git-check
run: echo modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi) >> $GITHUB_OUTPUT
run: |
echo modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi) >> $GITHUB_OUTPUT
echo diff=$(git diff) >> $GITHUB_OUTPUT
- name: Show check modified value
env:
CHANGED: ${{ steps.git-check.outputs.modified }}
DIFF: ${{ steps.git-check.outputs.diff }}
run: |
echo "$CHANGED"
echo "$DIFF"
- name: Push changes
# if: steps.changed-files.outputs.any_changed == 'true'
Expand All @@ -91,4 +99,4 @@ jobs:
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 --force-with-lease origin HEAD:refs/heads/${{ github.ref }}
git push
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion homestar-schemas/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "homestar-schemas"
publish = false
version = { workspace = true }
version = "0.1.0"
edition = { workspace = true }
rust-version = { workspace = true }

Expand Down

0 comments on commit 7d85584

Please sign in to comment.