-
Notifications
You must be signed in to change notification settings - Fork 40
73 lines (65 loc) · 2.28 KB
/
release.yml
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
73
name: Upload Release Asset
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- { os: darwin, arch: amd64 }
- { os: darwin, arch: arm64 }
- { os: linux, arch: amd64 }
- { os: linux, arch: ppc64le }
- { os: windows, arch: amd64 }
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Get the target release version
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Build
run: |
mkdir -p bin/
STATIC_FLAG='-w -extldflags "-static"'
VERSION=${{ steps.get_version.outputs.VERSION }}
CGO_ENABLED=0 GOOS=${{ matrix.platform.os }} GOARCH=${{ matrix.platform.arch }} \
go build -a -tags netgo -ldflags "-X github.com/ppc64le-cloud/pvsadm/pkg/version.Version=${VERSION} ${STATIC_FLAG}" \
-o bin/pvsadm-${{ matrix.platform.os }}-${{ matrix.platform.arch }}
tar -czvf pvsadm-${{ matrix.platform.os }}-${{ matrix.platform.arch }}.tar.gz -C bin/ pvsadm-${{ matrix.platform.os }}-${{ matrix.platform.arch }}
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: pvsadm-${{ matrix.platform.os }}-${{ matrix.platform.arch }}
path: |
bin/pvsadm-${{ matrix.platform.os }}-${{ matrix.platform.arch }}
pvsadm-${{ matrix.platform.os }}-${{ matrix.platform.arch }}.tar.gz
release:
needs: build
runs-on: ubuntu-latest
if: ${{ success() }}
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ./downloaded-artifacts
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ steps.get_version.outputs.VERSION }}
draft: true
prerelease: true
generate_release_notes: true
files: |
./downloaded-artifacts/**