1- name : Publish Package
1+ name : Version Bump
22
33on :
44 push :
55 branches :
66 - main
77
88jobs :
9- publish :
9+ version-bump :
1010 runs-on : ubuntu-latest
1111 steps :
1212 - uses : actions/checkout@v4
1313 with :
1414 fetch-depth : 0 # Required for version bumping
15+ ssh-key : ${{ secrets.DEPLOY_KEY }} # Use deploy key to bypass branch protection
1516
1617 - name : Setup Git
1718 run : |
@@ -38,34 +39,14 @@ jobs:
3839 - name : Build
3940 run : bun run build
4041
41- - name : Bump version and create PR
42+ - name : Bump version and push
4243 run : |
43- git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
44- # Create a new branch for the version bump
45- BRANCH_NAME="chore/bump-version-$(date +%s)"
46- git checkout -b $BRANCH_NAME
44+ # Use SSH URL for the repository
45+ git remote set-url origin [email protected] :${GITHUB_REPOSITORY}.git 4746 # Bump version
4847 npm version patch -m "chore: bump version to %s [skip ci]"
49- # Push the new branch
50- git push origin $BRANCH_NAME
51- # Create PR using GitHub CLI
52- gh pr create \
53- --title "chore: bump version" \
54- --body "Automated version bump" \
55- --base main \
56- --head $BRANCH_NAME
57- env :
58- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
59- GITHUB_CLI_TOKEN : ${{ secrets.GITHUB_TOKEN }}
60-
61- - name : Setup GitHub CLI
62- run : |
63- type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)
64- curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
65- && sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
66- && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
67- && sudo apt update \
68- && sudo apt install gh -y
48+ # Push directly to main
49+ git push origin HEAD:main --tags
6950
7051 - name : Publish to NPM
7152 run : npm publish
0 commit comments