Repository navigation
57 lines (48 loc) · 1.5 KB
/
Copy pathrelease.yml
File metadata and controls
57 lines (48 loc) · 1.5 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
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Read package version
id: meta
run: |
VERSION=$(grep '^const Version' version.go | sed 's/.*"\(.*\)".*/\1/')
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
echo "archive=reloop-go-$VERSION-source.zip" >> "$GITHUB_OUTPUT"
- name: Verify tag matches version.go
if: github.ref_type == 'tag'
run: |
TAG_VERSION="${GITHUB_REF_NAME#v}"
PKG_VERSION="${{ steps.meta.outputs.version }}"
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
echo "Tag v$TAG_VERSION does not match version.go version $PKG_VERSION"
exit 1
fi
- uses: actions/setup-go@v5
with:
go-version: "1.20"
- name: Test
run: go test ./...
- name: Create source archive
run: |
zip -r "${{ steps.meta.outputs.archive }}" . \
-x '*.git*' '.github/*'
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.meta.outputs.tag }}
name: Reloop Go SDK ${{ steps.meta.outputs.tag }}
generate_release_notes: true
files: |
${{ steps.meta.outputs.archive }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}