-
Notifications
You must be signed in to change notification settings - Fork 52
82 lines (73 loc) · 1.96 KB
/
release-agent.yaml
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
name: Hades-agent
on:
push:
tags:
- agent-v*
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: go env
uses: actions/setup-go@v2
with:
go-version: '1.20'
- name: make env
run: |
sudo apt-get install make
shell: bash
- name: build version
run: |
export TAG=${{github.ref}}
export BUILD_VERSION=$(echo $TAG | sed 's/refs\/tags\/agent-//')
echo "BUILD_VERSION=$BUILD_VERSION" >> $GITHUB_ENV
- name: auth
run: |
gh auth login --with-token <<<'${{ secrets.GITHUB_TOKEN }}'
- name: build
run: |
cd agent/deploy
BUILD_VERSION=${{ env.BUILD_VERSION }} sh build.sh
cd ../..
- name: upload
uses: actions/upload-artifact@v3
with:
path: /tmp/hades-agent*
name: hades-agent
release:
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v2
- name: create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# draft for testing!
draft: true
prerelease: false
release_name: Release ${{github.ref}}
tag_name: ${{github.ref}}
- name: version env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- uses: actions/download-artifact@v3
with:
path: /tmp/hades-agent
- name: release
run: |
set -x
assets=()
for asset in /tmp/hades-agent/hades-agent/*; do
assets+=("-a" "$asset")
echo ${asset}
done
tag_name="${GITHUB_REF##*/}"
hub release create "${assets[@]}" -m "$tag_name" "$tag_name"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
needs:
- build