From ef470dbb8bc412c627071fae807a887727ddbace Mon Sep 17 00:00:00 2001 From: tajo Date: Wed, 5 Jul 2023 02:37:12 -0700 Subject: [PATCH] simplify --- .github/workflows/publish.yml | 29 +---------------------------- scripts/bump-all.sh | 11 +++++++++++ 2 files changed, 12 insertions(+), 28 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 345bbeb..7f6a004 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,30 +10,8 @@ env: CARGO_INCREMENTAL: 0 jobs: - check_commit: - runs-on: ubuntu-latest - outputs: - skip: ${{ steps.check.outputs.skip }} - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Check commit message - id: check - run: | - commit_message=$(git log --format=%B -n 1) - echo "Commit message: $commit_message" - if [[ "$commit_message" == "Bump npm swc-plugin-fusion" ]]; then - echo "Found match, setting skip to true" - echo "::set-output name=skip::true" - else - echo "::set-output name=skip::false" - fi build: name: Build - needs: check_commit - if: needs.check_commit.outputs.skip != 'true' runs-on: ubuntu-latest permissions: contents: read @@ -77,15 +55,10 @@ jobs: env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Bump versions + - name: Bump versions and publish shell: bash run: | ./scripts/bump-all.sh env: GH_TOKEN: ${{ secrets.MY_GH_TOKEN }} - - - name: Publish npm packages - run: | - npm publish --workspaces --access public - env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/scripts/bump-all.sh b/scripts/bump-all.sh index 27558be..60e6d32 100755 --- a/scripts/bump-all.sh +++ b/scripts/bump-all.sh @@ -1,6 +1,15 @@ #!/usr/bin/env bash set -x +# Get the latest commit message +commit_message=$(git log --format=%B -n 1) + +# Check if the commit message matches the target string +if [[ "$commit_message" == "Bump npm swc-plugin-fusion" ]]; then + echo "Last commit message is 'Bump npm swc-plugin-fusion'. Skipping the job." + exit 0 +fi + git config --local --unset-all credential.helper git remote remove origin git remote add origin https://${GH_TOKEN}@github.com/tajo/swc-plugin-fusion.git @@ -15,3 +24,5 @@ git add . git commit -m "Bump npm swc-plugin-fusion" git push origin main git push origin main --tags +npm publish --workspaces +