-
Notifications
You must be signed in to change notification settings - Fork 14
79 lines (69 loc) · 2.36 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
74
75
76
77
78
79
name: 'Release'
on:
workflow_dispatch:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
jobs:
create-release:
name: create release
runs-on: ubuntu-latest
outputs:
upload-url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get the version
id: get_version
run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}
- name: "Build Changelog"
id: changelog
uses: mikepenz/release-changelog-builder-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: new release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: Policy Tester ${{ steps.get_version.outputs.version }}
tag_name: ${{ github.ref }}
body: |
${{ steps.changelog.outputs.changelog }}
env:
GITHUB_TOKEN: ${{ github.token }}
build:
name: build tool binaries
runs-on: ubuntu-latest
needs:
- create-release
strategy:
matrix:
include:
- {goos: "linux", goarch: "amd64"}
- {goos: "windows", goarch: "amd64"}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '1.17'
- name: Build for ${{ matrix.goos }}
working-directory: cmd/policyTester
run: |
export GOARCH=${{ matrix.goarch }}
export GOOS=${{ matrix.goos }}
go build -o bin/ .
zip -r -j bin/policy-tester.${{ needs.create-release.outputs.version }}.${{ matrix.goos }}-${{ matrix.goarch }}.zip bin/
- name: upload ${{ matrix.goos }} artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.create-release.outputs.upload-url }}
asset_path: cmd/policyTester/bin/policy-tester.${{ needs.create-release.outputs.version }}.${{ matrix.goos }}-${{ matrix.goarch }}.zip
asset_name: policy-tester.${{ needs.create-release.outputs.version }}.${{ matrix.goos }}-${{ matrix.goarch }}.zip
asset_content_type: application/zip