-
Notifications
You must be signed in to change notification settings - Fork 3
85 lines (76 loc) · 2.26 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
80
81
82
83
84
85
name: Releases
on:
push:
branches:
- main
jobs:
create-release:
runs-on: ubuntu-latest
outputs:
release-id: ${{ steps.create_release.outputs.id }}
release-tag: ${{ steps.short-sha.outputs.sha }}
steps:
- uses: benjlevesque/[email protected]
id: short-sha
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.short-sha.outputs.sha }}
release_name: ${{ steps.short-sha.outputs.sha }}
body: |
Release ${{ steps.short-sha.outputs.sha }}
draft: false
prerelease: true
build-upload-assets:
needs: [create-release]
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, windows, darwin]
goarch: [amd64]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Run go generate
run: make go-generate
- name: Release ${{ matrix.goos }}-${{ matrix.goarch }}
uses: wangyoucao577/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: https://dl.google.com/go/go1.20.7.linux-amd64.tar.gz
pre_command: export CGO_ENABLED=0
build_flags: -a -tags netgo
binary_name: harbor-scanner-fake
release_tag: ${{ needs.create-release.outputs.release-tag }}
- name: Rollback Release
if: failure()
uses: author/action-rollback@stable
with:
release_id: ${{ needs.create-release.outputs.release-id }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-release:
needs: [create-release, build-upload-assets]
runs-on: ubuntu-latest
steps:
- uses: meeDamian/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ needs.create-release.outputs.release-tag }}
prerelease: false
allow_override: true
delete-older-releases:
needs: [publish-release]
runs-on: ubuntu-latest
steps:
- uses: dev-drprasad/[email protected]
with:
keep_latest: 1
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}