-
Notifications
You must be signed in to change notification settings - Fork 16
56 lines (48 loc) · 1.53 KB
/
latest.yml
File metadata and controls
56 lines (48 loc) · 1.53 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
name: TFx Latest
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
jobs:
latest:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Compute next version
id: version
run: |
LATEST_TAG=$(git describe --tags --abbrev=0 --match "v[0-9]*.[0-9]*.[0-9]*" 2>/dev/null || echo "v0.0.0")
RAW="${LATEST_TAG#v}"
IFS='.' read -r MAJOR MINOR PATCH <<< "$RAW"
SHORT_SHA=$(git rev-parse --short HEAD)
VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))-${SHORT_SHA}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Computed: stable=${LATEST_TAG}, next=${VERSION}"
- name: Delete existing latest release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release delete latest --yes --cleanup-tag || true
- name: Create latest tag
run: |
git tag -f latest
git push -f origin latest
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: "~> v2"
args: release --clean --skip=validate -f .goreleaser-latest.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
TFX_VERSION: ${{ steps.version.outputs.version }}