-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (60 loc) · 1.93 KB
/
Copy pathrelease.yml
File metadata and controls
72 lines (60 loc) · 1.93 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Release
on:
workflow_dispatch:
inputs:
bump:
description: Semver bump to apply over the latest release
type: choice
default: patch
options:
- patch
- minor
- major
permissions:
contents: write
actions: write
concurrency:
group: release
cancel-in-progress: false
jobs:
release:
name: Cut release (${{ inputs.bump }})
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 24.x
- name: Compute next version
id: version
run: |
latest_tag="$(git tag -l 'v*' --sort=-v:refname | head -n1 | sed 's/^v//')"
npm_latest="$(npm view @patchstack/connect version 2>/dev/null || echo 0.0.0)"
current="$(npx --yes semver "${latest_tag:-0.0.0}" "$npm_latest" | tail -n1)"
next="$(npx --yes semver -i "${{ inputs.bump }}" "$current")"
echo "Latest git tag: ${latest_tag:-none}"
echo "npm latest: $npm_latest"
echo "Bumping from: $current"
echo "Next version: $next (bump: ${{ inputs.bump }})"
if git ls-remote --tags origin "refs/tags/v$next" | grep -q .; then
echo "::error::Tag v$next already exists on origin."
exit 1
fi
echo "next=$next" >> "$GITHUB_OUTPUT"
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "v${{ steps.version.outputs.next }}" \
--target "${{ github.sha }}" \
--title "v${{ steps.version.outputs.next }}" \
--generate-notes
- name: Trigger publish
env:
GH_TOKEN: ${{ github.token }}
run: |
gh workflow run publish.yml -f version="${{ steps.version.outputs.next }}"