-
Notifications
You must be signed in to change notification settings - Fork 128
57 lines (49 loc) · 1.96 KB
/
label-alpha-bump.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Autobump
on:
pull_request:
types:
- labeled # Triggers when any label is added to the PR
jobs:
debug:
name: debug
runs-on: ubuntu-20.04
steps:
- name: output debug info
run: |
echo "Check Suite JSON:"
echo '${{ toJson(github.event) }}' | jq .
echo "Pull Request Labels JSON:"
echo '${{ toJson(github.event.pull_request.labels) }}' | jq .
label-alpha-bump:
name: Release alpha version based on PR label
runs-on: ubuntu-20.04
if: |
contains(github.event.pull_request.labels.*.name, 'bump alpha')
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.ref }}
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}
fetch-depth: 0
- uses: pnpm/action-setup@v4
with:
version: 8.x.x
- name: Determine new version
id: versions
if: steps.bump-type.outputs.bump-type != 'null'
run: |
OLD_VERSION=$(jq ".version" package.json -r)
NEW_VERSION=$(npx semver $OLD_VERSION -i pre-release --preid alpha)
echo "old-version=$OLD_VERSION" >> "$GITHUB_OUTPUT"
echo "new-version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
- name: Update version in package.json
if: steps.bump-type.outputs.bump-type != 'null'
run: |
mv package.json package.old.json
jq --indent 4 '.version = "${{ steps.versions.outputs.new-version }}"' package.old.json > package.json
rm package.old.json
- name: Publish the alpha in the npm registry
run: npm publish --access public --dry-run
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}