Skip to content

Commit

Permalink
Chore: refactor publish workflow for sqlglotrs releasing
Browse files Browse the repository at this point in the history
  • Loading branch information
georgesittas committed May 4, 2024
1 parent c162b06 commit aa4f90a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ jobs:
should-deploy-rs:
runs-on: ubuntu-latest
outputs:
deploy: ${{ steps.check_deploy.outputs.deploy }}
deploy: ${{ steps.set_deploy.outputs.deploy }}
steps:
- uses: actions/checkout@v3
- id: check_deploy
name: Check if sqlglotrs should be deployed
run: |
bash ./.github/workflows/should_deploy_sqlglotrs.sh
if [ $? -eq 0 ]; then exit 1; fi
- name: Check if sqlglotrs should be deployed
run: bash ./.github/workflows/should_deploy_sqlglotrs.sh
- id: set_deploy
run: echo "deploy=true" >> $GITHUB_OUTPUT

build-rs:
needs: should-deploy-rs
if: needs.should-deploy-rs.outputs.deploy == 'true'
strategy:
matrix:
os: [linux, macos, windows]
Expand Down Expand Up @@ -65,6 +65,7 @@ jobs:

sdist-rs:
needs: should-deploy-rs
if: needs.should-deploy-rs.outputs.deploy == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -82,6 +83,7 @@ jobs:

deploy-rs:
needs: [should-deploy-rs, build-rs, sdist-rs]
if: needs.should-deploy-rs.outputs.deploy == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/should_deploy_sqlglotrs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,4 @@ PREVIOUS_TAG=$(git tag --sort=-creatordate | head -n 2 | tail -n 1)
PREVIOUS_TAG_COMMIT=$(git rev-list -n 1 $PREVIOUS_TAG)

# We should only deploy sqlglotrs if Cargo.toml was modified between this tag and the previous one
SHOULD_DEPLOY=$(git merge-base --is-ancestor $PREVIOUS_TAG_COMMIT $CARGO_TOML_MOST_RECENT_COMMIT)

# Print the SHOULD_DEPLOY variable for debugging purposes
echo "SHOULD_DEPLOY: $SHOULD_DEPLOY"
exit $SHOULD_DEPLOY
git merge-base --is-ancestor $PREVIOUS_TAG_COMMIT $CARGO_TOML_MOST_RECENT_COMMIT

0 comments on commit aa4f90a

Please sign in to comment.