Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
tajo committed Jul 5, 2023
1 parent fe2d113 commit ef470db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 28 deletions.
29 changes: 1 addition & 28 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
11 changes: 11 additions & 0 deletions scripts/bump-all.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

0 comments on commit ef470db

Please sign in to comment.