Skip to content

Commit 9c7cac6

Browse files
authored
Create bump-release.yaml
1 parent 2bb3033 commit 9c7cac6

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: bump and release
2+
on:
3+
workflow_call:
4+
inputs:
5+
workflow_file:
6+
description: "Optional workflow file to run with gh workflow"
7+
required: false
8+
type: string
9+
branch:
10+
description: "Optional git branch to pass to autotag"
11+
required: false
12+
type: string
13+
prefix:
14+
description: "prefix semver with a string"
15+
required: false
16+
type: string
17+
jobs:
18+
bump-release:
19+
runs-on: ubuntu-24.04
20+
steps:
21+
- name: Checkout
22+
uses: "actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8" # v6
23+
with:
24+
fetch-depth: 0
25+
26+
- name: install autotag binary
27+
run: |
28+
gh release download "$TAG" --repo "$REPO" --pattern "$BINARY"
29+
echo "$SHA256 $BINARY" | shasum -a 256 -c
30+
31+
chmod +x "$BINARY"
32+
sudo mv "$BINARY" /usr/bin/autotag
33+
env:
34+
REPO: autotag-dev/autotag
35+
BINARY: autotag_linux_amd64
36+
TAG: v1.4.3
37+
SHA256: 85e7ec97d732800bb838085fd3f2e19b2aa2ee3a8da0db7fd0aaf4113a279f3a
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Bump git tag and create GitHub Release
41+
run: |-
42+
if [ "${{ inputs.branch }}" = "" ]; then
43+
TAG=$(autotag)
44+
git tag "${{ inputs.prefix }}$TAG" || echo continue
45+
else
46+
TAG=$(autotag -b "${{ inputs.branch }}")
47+
fi
48+
git push origin "${{ inputs.prefix }}$TAG"
49+
gh release create "${{ inputs.prefix }}$TAG" --title "${{ inputs.prefix }}$TAG" --generate-notes
50+
if [ "${{ inputs.workflow_file }}" != "" ]; then
51+
gh workflow run ${{ inputs.workflow_file }} --ref "${{ inputs.prefix }}$TAG"
52+
fi
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)