-
Notifications
You must be signed in to change notification settings - Fork 151
68 lines (58 loc) · 2.88 KB
/
releases.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
name: Build and publish artifacts
on:
release:
types: [published]
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
ref: ${{ github.ref }}
- run: ./scripts/ci/prepare_linux.sh
- run: echo "GIT_TAG=`git tag --points-at HEAD`" >> $GITHUB_ENV
- run: |
echo "RELEASE_ID=`curl -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/multiprocessio/dsq/releases/tags/$GIT_TAG | jq '.id'`" >> $GITHUB_ENV
- run: go build -trimpath -buildmode=pie -mod=readonly -modcacherw -ldflags "-s -w -X main.Version=$GIT_TAG"
- run: zip dsq-linux-x64-$GIT_TAG.zip dsq
- name: Upload on release
run: |
curl --fail \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/zip" \
--data-binary @./dsq-linux-x64-$GIT_TAG.zip \
"https://uploads.github.com/repos/multiprocessio/dsq/releases/$RELEASE_ID/assets?name=dsq-linux-x64-$GIT_TAG.zip"
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@master
with:
ref: ${{ github.ref }}
- run: ./scripts/ci/prepare_macos.sh
- run: echo "GIT_TAG=`git tag --points-at HEAD`" >> $GITHUB_ENV
- run: |
echo "RELEASE_ID=`curl -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/multiprocessio/dsq/releases/tags/$GIT_TAG | jq '.id'`" >> $GITHUB_ENV
- run: go build -trimpath -buildmode=pie -mod=readonly -modcacherw -ldflags "-s -w -X main.Version=$GIT_TAG"
- run: zip dsq-darwin-x64-$GIT_TAG.zip dsq
- name: Upload release
run: |
curl --fail \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/zip" \
--data-binary @./dsq-darwin-x64-$GIT_TAG.zip \
"https://uploads.github.com/repos/multiprocessio/dsq/releases/$RELEASE_ID/assets?name=dsq-darwin-x64-$GIT_TAG.zip"
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@master
with:
ref: ${{ github.ref }}
- run: ./scripts/ci/prepare_windows.ps1
- run: echo "GIT_TAG=$(git tag --points-at HEAD)" >> $Env:GITHUB_ENV
- run: |
echo "RELEASE_ID=$(curl -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/multiprocessio/dsq/releases/tags/$Env:GIT_TAG | jq '.id')" >> $Env:GITHUB_ENV
- run: go build -trimpath -buildmode=pie -mod=readonly -modcacherw -ldflags "-s -w -X main.Version=$Env:GIT_TAG"
- run: zip dsq-win32-x64-$Env:GIT_TAG.zip dsq.exe
- name: Upload release
run: |
curl --fail -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -H "Content-Type: application/zip" --data-binary "@./dsq-win32-x64-$Env:GIT_TAG.zip" "https://uploads.github.com/repos/multiprocessio/dsq/releases/$Env:RELEASE_ID/assets?name=dsq-win32-x64-$Env:GIT_TAG.zip"