-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (61 loc) · 2.07 KB
/
Copy pathrelease.yml
File metadata and controls
72 lines (61 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
68
69
70
71
72
name: release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
version:
description: "Release version, for example v0.3.0"
required: true
default: "v0.3.0"
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: "1.26.x"
- name: Test
run: go test ./...
- name: Resolve version
id: version
shell: bash
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
version="${{ inputs.version }}"
else
version="${GITHUB_REF_NAME}"
fi
if [[ ! "$version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then
echo "invalid release version: $version" >&2
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Build release artifacts
run: sh scripts/build-release.sh "${{ steps.version.outputs.version }}"
- name: Upload workflow artifacts
uses: actions/upload-artifact@v4
with:
name: ipxray-${{ steps.version.outputs.version }}
path: dist/*
- name: Publish GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "${{ steps.version.outputs.version }}" \
dist/ipxray_${{ steps.version.outputs.version }}_darwin_amd64.tar.gz \
dist/ipxray_${{ steps.version.outputs.version }}_darwin_arm64.tar.gz \
dist/ipxray_${{ steps.version.outputs.version }}_linux_amd64.tar.gz \
dist/ipxray_${{ steps.version.outputs.version }}_linux_arm64.tar.gz \
dist/ipxray_${{ steps.version.outputs.version }}_windows_amd64.zip \
dist/ipxray_${{ steps.version.outputs.version }}_windows_arm64.zip \
dist/checksums.txt \
--title "ipxray ${{ steps.version.outputs.version }}" \
--notes-file dist/RELEASE_NOTES.md \
--latest