Core

/.github/workflows/release.yml (2.8 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
name: release
{{{ .CIContent }}}
permissions:
contents: write
jobs:{{{ if .Build.TestsFail }}}
test:
uses: "./.github/workflows/test.yml"{{{ end }}}
build:
runs-on: "ubuntu-latest"
steps:{{{ if .HasSlack }}}
- name: "Slack"
uses: ravsamhq/notify-slack-action@v1
if: always()
with:
status: ${{ job.status }}
notify_when: 'failure'
env:
SLACK_WEBHOOK_URL: "{{{ .Info.Slack }}}"{{{ end }}}
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 0
- name: "Golang"
uses: "actions/setup-go@v2"
with:
go-version: "{{{ .GoVersionSafe }}}"
- name: "Login"
uses: "docker/login-action@v1"
with:
registry: "ghcr.io"
username: "${{ github.repository_owner }}"
password: "${{ secrets.CR_PAT }}"
- name: "Cache"
uses: "actions/cache@v2"
with:
path: "~/go/pkg/mod"
key: "${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}"
restore-keys: |
${{ runner.os }}-go-
- name: "Dependencies"
run: "bin/bootstrap.sh"{{{ if .Build.Snapcraft }}}
- name: "Snapcraft"
run: "sudo snap install snapcraft --classic"
- name: "Snapcraft Fix"
run: "mkdir -p /home/runner/.cache/snapcraft/download; mkdir -p /home/runner/.cache/snapcraft/stage-packages"{{{ end }}}{{{ if .Build.NFPMS }}}
- name: "nfpms"
run: "go install github.com/goreleaser/nfpm/v2/cmd/nfpm@latest"{{{ end }}}
- name: "Config"
env:
OWNER: "${{ github.repository_owner }}"
TOKEN: "${{ secrets.CR_PAT }}"
run: "git config --global url.\"https://${OWNER}:${TOKEN}@github.com\".insteadOf \"https://github.com\""
- name: "Templates"
run: "bin/templates.sh"
- name: "Modules"
run: "go mod download"
env:
GOPRIVATE: "github.com/${{ github.repository_owner }}"
GITHUB_TOKEN: "${{ secrets.CR_PAT }}"
OWNER: "${{ github.repository_owner }}"
TOKEN: "${{ secrets.CR_PAT }}"
- name: "Release"
uses: "goreleaser/goreleaser-action@v4"
with:
distribution: "goreleaser"
version: "latest"
args: "-f ./tools/release/.goreleaser.yml release --clean"
env:{{{ if .HasSlack }}}
SLACK_WEBHOOK: "{{{ .Info.Slack }}}"{{{ end }}}
GOPRIVATE: "github.com/${{ github.repository_owner }}"
GITHUB_TOKEN: "${{ secrets.CR_PAT }}"{{{ if .Build.Homebrew }}}
HOMEBREW_GITHUB_API_TOKEN: "${{ secrets.CR_PAT }}"{{{ end }}}
OWNER: "${{ github.repository_owner }}"
TOKEN: "${{ secrets.CR_PAT }}"