-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (88 loc) · 2.69 KB
/
ci.yml
File metadata and controls
102 lines (88 loc) · 2.69 KB
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
name: Go Build and Release
on:
push:
branches:
- master
tags:
- v[0-9].[0-9].[0-9]+
- v[0-9].[0-9]+.[0-9]+-beta
jobs:
build:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
- name: Run Tests
run: make test
release:
permissions: write-all
name: Release
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Check for Tag
id: check_for_tag
run: echo "::set-output name=tag::$(echo ${{ github.ref }} | sed 's/refs\/tags\///')"
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.GITHUB_REF }}
files: dist/*
draft: false
prerelease: false
nightly_tag:
permissions: write-all
name: Create Nightly Release
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Checkout Repository
uses: actions/checkout@v2
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
project_name: subzero
distribution: goreleaser
version: latest
args: release --clean --snapshot
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Git
run: |
git config --global user.email "ci@subzero.none"
git config --global user.name "Subzero CI"
- name: Set Build Suffix
id: set_build_suffix_nightly
run: echo "::set-output name=suffix::nightly"
- name: Get Short Commit Hash
id: get_commit_hash
run: echo "::set-output name=commit_hash::$(echo ${{ github.sha }} | cut -c1-7)"
- name: Create Tag
id: create_nightly_tag
run: git tag -a nightly-${{ steps.get_commit_hash.outputs.commit_hash }} -m "Nightly Build \# ${{ steps.get_commit_hash.outputs.commit_hash }}"
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: nightly-${{ steps.get_commit_hash.outputs.commit_hash }}
files: dist/*
draft: false
prerelease: true