Skip to content

Commit 7929668

Browse files
committed
feat: added option to release beta versions
1 parent b8b23d9 commit 7929668

File tree

4 files changed

+84
-14
lines changed

4 files changed

+84
-14
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Create beta release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
next:
7+
description: 'The next increment to create the release for'
8+
required: true
9+
default: 'minor'
10+
type: choice
11+
options:
12+
- major
13+
- minor
14+
15+
jobs:
16+
goreleaser:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Check out code
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Fetch tags
25+
run: git fetch --force --tags
26+
27+
- name: Set up Go
28+
uses: actions/setup-go@v4
29+
with:
30+
go-version-file: go.mod
31+
32+
- name: Get goreleaser app token
33+
id: get-app-token
34+
uses: labd/action-gh-app-token@main
35+
with:
36+
app-id: ${{ secrets.MCI_APP_ID }}
37+
private-key: ${{ secrets.MCI_APP_PRIVATE_KEY }}
38+
installation-id: ${{ secrets.MCI_APP_INSTALLATION_ID }}
39+
40+
- name: Get hash
41+
shell: bash
42+
run: |
43+
HASH=$(git rev-parse --short "$GITHUB_SHA")
44+
echo "HASH=$HASH" >> $GITHUB_ENV
45+
46+
- name: Get the next potential version
47+
id: next-tag
48+
uses: miniscruff/changie-action@v2
49+
with:
50+
version: latest
51+
args: next -p beta-${{ env.HASH }} ${{ github.event.inputs.next }}
52+
53+
- name: Output changes
54+
uses: miniscruff/changie-action@v2
55+
id: changelog
56+
with:
57+
version: latest
58+
args: batch --dry-run -p beta-${{ env.HASH }} ${{ github.event.inputs.next }}
59+
60+
- name: Save ChangeLog to file
61+
id: save_changes
62+
run: |
63+
tmpfile=$(mktemp)
64+
echo "${{ steps.changelog.outputs.output }}" > $tmpfile
65+
echo "changelog_file=$tmpfile" >> $GITHUB_OUTPUT
66+
shell: bash
67+
68+
- name: GoReleaser
69+
uses: goreleaser/goreleaser-action@v5
70+
with:
71+
args: release --clean --skip=validate --release-notes ${{ steps.save_changes.outputs.changelog_file }}
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
GOPATH: ${{ env.GOPATH }}
75+
GORELEASER_CURRENT_TAG: ${{ steps.next-tag.outputs.output }}
76+
PRERELEASE: true

.goreleaser.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
project_name: mach-composer-plugin-honeycomb
22

3+
env:
4+
- PRERELEASE={{ if index .Env "PRERELEASE" }}{{ .Env.PRERELEASE }}{{ else }}false{{ end }}
5+
36
builds:
47
- id: "mach-composer-plugin"
58
main: ./main.go
@@ -24,6 +27,10 @@ checksum:
2427
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
2528
algorithm: sha256
2629

30+
release:
31+
mode: replace
32+
prerelease: "{{ .Env.PRERELEASE }}"
33+
2734
changelog:
2835
sort: asc
2936
filters:

Taskfile.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ tasks:
77
build:
88
env:
99
GORELEASER_CURRENT_TAG: v0.0.0
10-
cmd: goreleaser build --snapshot --single-target --rm-dist --clean
10+
cmd: goreleaser build --snapshot --single-target --clean
1111

1212
test:
1313
cmd: go test -race ./...

plugin/main.go

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)