-
Notifications
You must be signed in to change notification settings - Fork 2
90 lines (79 loc) · 3.18 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
---
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*.*.*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
build:
runs-on: macos-latest
timeout-minutes: 10
strategy:
max-parallel: 1
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set output
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Check output
env:
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
run: |
echo $RELEASE_VERSION
echo ${{ steps.vars.outputs.tag }}
- name: Install go
run: |
curl -L -o /tmp/go.pkg https://golang.org/dl/go1.17.darwin-amd64.pkg
sudo installer -pkg /tmp/go.pkg -target /
- name: Run tests
run: |
/usr/local/go/bin/go test ./core
- name: Build universal binary
run: |
/bin/bash .github/build.sh
- name: Ensure verison matches
run: |
/bin/chmod +x ./committer
[[ "$(./committer --version)" == "$(echo '${{ steps.vars.outputs.tag }}' | /usr/bin/sed s/v//g)" ]]
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ steps.vars.outputs.tag }}
release_name: Release ${{ steps.vars.outputs.tag }}
body: 'Please enter details before publishing draft release'
draft: true
prerelease: true
- name: Upload Release Asset (Darwin)
id: upload-release-asset-darwin
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./committer
asset_name: committer-${{ steps.vars.outputs.tag }}
asset_content_type: application/octet-stream
- name: Upload Release Asset (Linux amd64)
id: upload-release-asset-linux-amd64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./committer.linux-amd64
asset_name: committer-${{ steps.vars.outputs.tag }}.linux-amd64
asset_content_type: application/octet-stream
- name: Upload Release Asset (Linux arm64)
id: upload-release-asset-linux-arm64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./committer.linux-arm64
asset_name: committer-${{ steps.vars.outputs.tag }}.linux-arm64
asset_content_type: application/octet-stream