Skip to content

Commit 758ee18

Browse files
authored
Merge pull request #160 from nodenv/autobump
Add autoversioning workflow ala node-build
2 parents ccad768 + f026907 commit 758ee18

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/version.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Version Bump
2+
on:
3+
push: { branches: main, paths: "share/node-build/**" }
4+
schedule: [{ cron: "0 10 * * SAT" }] # weekly: https://crontab.guru/#0_10_*_*_SAT
5+
workflow_dispatch:
6+
inputs:
7+
version: # checkov:skip=CKV_GHA_7
8+
description: "An explicit version (or major|minor|patch) to tag."
9+
default: ""
10+
required: false
11+
type: string
12+
13+
permissions: { contents: read }
14+
jobs:
15+
bump:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
19+
with: { egress-policy: audit }
20+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
21+
with:
22+
fetch-depth: 0
23+
token: ${{ secrets.BOT_TOKEN }}
24+
25+
- if: ${{ !inputs.version }}
26+
run: |-
27+
npm run preversion --silent -- -o -v -- share/node-build || status=$?
28+
case "${status:-0}" in
29+
0) echo "bump=patch" >> "$GITHUB_ENV";;
30+
1) exit 0;; # exit successfully to mask error, but don't release
31+
*) exit "$status" ;; # all other error codes are true failures
32+
esac
33+
34+
- if: ${{ inputs.version || env.bump }}
35+
run: npm version ${{ inputs.version || env.bump }}
36+
env:
37+
GIT_AUTHOR_NAME: ${{ vars.NODENV_BOT_NAME }}
38+
GIT_AUTHOR_EMAIL: ${{ vars.NODENV_BOT_EMAIL }}
39+
GIT_COMMITTER_NAME: ${{ vars.GHA_BOT_NAME }}
40+
GIT_COMMITTER_EMAIL: ${{ vars.GHA_BOT_EMAIL }}

0 commit comments

Comments
 (0)