-
Notifications
You must be signed in to change notification settings - Fork 1
69 lines (67 loc) · 2.01 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
on:
push:
tags:
- "v*"
name: Create Release
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
os: [linux, darwin, windows]
arch: [386, amd64, arm64]
exclude:
- os: darwin
arch: 386
- os: windows
arch: arm64
steps:
- name: Set RELEASE_VERSION
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: "1.18"
- name: Checkout Code
uses: actions/checkout@v2
- name: Add Windows Exe File Extension
if: matrix.os == 'windows'
run: echo "FILE_EXTENSION=.exe" >> $GITHUB_ENV
- name: Build Code
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
run: go build -ldflags="-X 'github.com/plumber-cd/runtainer/cmd.Version==${{ env.RELEASE_VERSION }}'" -o build/runtainer-${{ matrix.os }}-${{ matrix.arch }}${{ env.FILE_EXTENSION }}
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
name: runtainer
path: build/runtainer-${{ matrix.os }}-${{ matrix.arch }}${{ env.FILE_EXTENSION }}
release:
name: Draft Release
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Download Artifacts
uses: actions/download-artifact@v1
with:
name: runtainer
- name: Generate SHA256SUMS
run: |
cd runtainer && sha256sum * > SHA256SUMS
- name: List Artifacts
run: echo "ARTIFACTS=$(echo runtainer/*)" >> $GITHUB_ENV
- name: Release
uses: docker://antonyurchenko/git-release:v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DRAFT_RELEASE: "true"
PRE_RELEASE: "false"
CHANGELOG_FILE: "CHANGELOG.md"
ALLOW_EMPTY_CHANGELOG: "false"
with:
args: |
${{ env.ARTIFACTS }}