-
Notifications
You must be signed in to change notification settings - Fork 5
103 lines (100 loc) · 3.7 KB
/
publish.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
on:
push:
tags:
- 'v*'
name: Build and publish release
jobs:
build:
name: Build and publish release
runs-on: 'ubuntu-latest'
steps:
- name: Checkout code
uses: actions/checkout@master
- uses: actions/setup-go@v2
with:
go-version: '1.20.5'
- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Test project
run: ./test.sh
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: Build project
run: scripts/build.sh ${{ steps.get_version.outputs.VERSION }}
- name: Create release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: Release ${{ steps.get_version.outputs.VERSION }}
draft: false
prerelease: false
- name: Upload tarball
id: upload-release-asset-tarball
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./cdflow2-${{ steps.get_version.outputs.VERSION }}.tar.gz
asset_name: cdflow2-${{ steps.get_version.outputs.VERSION }}.tar.gz
asset_content_type: application/gzip
- name: Upload mac binary
id: upload-release-asset-mac
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./cdflow2-darwin-amd64
asset_name: cdflow2-darwin-amd64
asset_content_type: application/x-mach-binary
- name: Upload linux binary
id: upload-release-asset-linux
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./cdflow2-linux-amd64
asset_name: cdflow2-linux-amd64
asset_content_type: application/x-executable
- name: Upload windows binary
id: upload-release-asset-windows
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./cdflow2-windows-amd64
asset_name: cdflow2-windows-amd64
asset_content_type: application/vnd.microsoft.portable-executable
- name: Upload linux ARM binary
id: upload-release-asset-linuxarm
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./cdflow2-linux-arm64
asset_name: cdflow2-linux-arm64
asset_content_type: application/x-executable
- name: Setup SSH Keys and known_hosts
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
mkdir -p ~/.ssh
ssh-keyscan github.com >> ~/.ssh/known_hosts
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add - <<< "${{ secrets.HOMEBREW_TAP_DEPLOY_KEY }}"
- name: Update homebrew tap
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: scripts/update-homebrew-tap.sh ${{ steps.get_version.outputs.VERSION }}