-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (112 loc) · 4 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# This is a basic workflow to help you get started with Actions
name: Release
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ release ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
test:
name: Test
runs-on: "ubuntu-latest"
steps:
- uses: actions/setup-go@v3
with:
go-version: "1.21.x"
- uses: actions/checkout@v3
- run: go mod download
- run: make test
release:
name: Create Release
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.21.x'
- name: Setup Ubuntu
run: sudo apt-get update && sudo apt-get install -y gcc-multilib
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v2
with:
git_user_signingkey: true
git_commit_gpgsign: true
git_tag_gpgsign: true
git_committer_email: [email protected]
git_committer_name: Automations
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.GPG_PASSWORD }}
- name: Conventional Changelog Action
id: changelog
uses: TriPSs/conventional-changelog-action@v3
with:
github-token: ${{ secrets.ADMIN_TOKEN }}
git-user-name: Automations
git-user-email: [email protected]
skip-on-empty: 'true'
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
if: ${{ steps.changelog.outputs.skipped == 'false' }}
with:
tag_name: ${{ steps.changelog.outputs.tag }}
name: ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.clean_changelog }}
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
if: ${{ steps.changelog.outputs.skipped == 'false' }}
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
if: ${{ steps.changelog.outputs.skipped == 'false' }}
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: ${{ steps.changelog.outputs.skipped == 'false' }}
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Binaries
if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: make all_zip
- name: Build Docker
if: ${{ steps.changelog.outputs.skipped == 'false' }}
env:
DOCKER_REPO: ${{ secrets.DOCKER_REPO }}
DOCKER_BUILDKIT: 1
run: make docker
- name: Upload Archives to Release
if: ${{ steps.changelog.outputs.skipped == 'false' }}
env:
UPLOAD_URL: ${{ steps.create_release.outputs.upload_url }}
API_HEADER: "Accept: application/vnd.github.v3+json"
AUTH_HEADER: "Authorization: token ${{ secrets.GITHUB_TOKEN }}"
run: |
UPLOAD_URL=$(echo -n $UPLOAD_URL | sed s/\{.*//g)
for FILE in bin/*.zip
do
echo "Uploading ${FILE}";
curl \
-H "${API_HEADER}" \
-H "${AUTH_HEADER}" \
-H "Content-Type: $(file -b --mime-type ${FILE})" \
--data-binary "@${FILE}" \
"${UPLOAD_URL}?name=$(basename ${FILE})";
done
- name: Push Docker
if: ${{ steps.changelog.outputs.skipped == 'false' }}
env:
DOCKER_REPO: ${{ secrets.DOCKER_REPO }}
run: docker push $DOCKER_REPO --all-tags
- name: Push to master
uses: ad-m/github-push-action@master
if: ${{ steps.changelog.outputs.skipped == 'false' }}
with:
github_token: ${{ secrets.ADMIN_TOKEN }}