This repository has been archived by the owner on Feb 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (60 loc) · 1.99 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
name: release
on:
push:
tags:
- '*'
jobs:
# Publish project package(s)
publish:
name: publish package
runs-on: ubuntu-latest
timeout-minutes: 10
if: startsWith(github.ref, 'refs/tags/')
steps:
# Go 1.15
- name: Set up Go 1.15
uses: actions/setup-go@v2
with:
go-version: ^1.15
# Checkout code
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 2
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- name: Checkout pull request head
if: ${{ github.event_name == 'pull_request' }}
run: git checkout HEAD^2
# Prepare runner environment
- name: Set up runner environment
run: ./.github/workflows/assets/utils.sh setup
env:
GITHUB_USER: ${{ github.actor }}
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
# If "vendor" is in cache, restore.
# To run conditional steps use:
# if: steps.vendor-cache.outputs.cache-hit != 'true'
- name: Restore vendor from cache
id: vendor-cache
uses: actions/[email protected]
env:
cache-name: vendor
with:
path: ./vendor
key: ${{ env.cache-name }}-${{ hashFiles('go.sum') }}
# Ensure project compile and build successfully
- name: Build
run: make build-for os=linux arch=amd64
# Use goreleaser to create the new release
- name: Create release
uses: goreleaser/goreleaser-action@v2
if: startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --rm-dist --skip-validate
env:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
# Login of the user that initiated the workflow run
GITHUB_USER: ${{ github.actor }}