-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (58 loc) · 2.07 KB
/
Copy pathbuild.yml
File metadata and controls
67 lines (58 loc) · 2.07 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
name: Release
on:
push:
tags:
- 'v*.*.*' # Matches tags like v1.0.0, v2.1.3, v0.2.0-rc.1
permissions:
contents: write # create the release and upload its assets
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v7
with:
fetch-depth: 0 # the tag check needs main, and git describe needs the tags
- name: Check that a release tag is on main
run: |
# A pre-release tag (for example v0.2.0-dev.1a2b3c4 from make
# dev-release) can come from any branch: /releases/latest never
# returns a pre-release, so installed CLIs do not update to it.
if [[ "$GITHUB_REF_NAME" == *-* ]]; then
echo "Pre-release tag $GITHUB_REF_NAME: any branch is allowed."
exit 0
fi
git fetch --no-tags origin main
if ! git merge-base --is-ancestor "$GITHUB_SHA" origin/main; then
echo "::error::Tag $GITHUB_REF_NAME is not on main. Release tags must be on the release branch."
exit 1
fi
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version: '1.27'
check-latest: true
- name: Run the checks
run: make check
# Installed CLIs download fly-linux-<arch>.tar.gz and look for the binary
# fly-linux-<arch> in it. Do not change these asset names.
- name: Build the release archives
run: make release VERSION="$GITHUB_REF_NAME"
- name: Create the GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
# A pre-release (for example v0.2.0-rc.1) is not returned by
# /releases/latest, so installed CLIs do not update to it.
prerelease=()
if [[ "$GITHUB_REF_NAME" == *-* ]]; then
prerelease=(--prerelease)
fi
gh release create "$GITHUB_REF_NAME" \
build/fly-linux-amd64.tar.gz \
build/fly-linux-arm64.tar.gz \
build/checksums.txt \
--title "$GITHUB_REF_NAME" \
--generate-notes \
--verify-tag \
"${prerelease[@]}"