-
Notifications
You must be signed in to change notification settings - Fork 24
102 lines (90 loc) · 2.69 KB
/
go.yml
File metadata and controls
102 lines (90 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
on:
workflow_dispatch:
pull_request_target:
branches: [main, develop]
push:
branches: [main, develop, feature/*]
paths-ignore:
- README.md
- .github/workflows/go.yml
- .gitignore
tags:
- "*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21
- name: Install dependencies
continue-on-error: true
run: |
go get -u
- name: Snapshot
uses: goreleaser/goreleaser-action@v6
with:
args: --snapshot --clean
version: latest
distribution: goreleaser
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
UNSPLASH_CLIENT_ID: ${{ secrets.CLIENT_ID }}
UNSPLASH_CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
LOG_FORMAT: json
LOG_LEVEL: trace
ENABLE_SENTRY_DEBUG: false
DEBUG: true
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: Snapshot
path: dist
- name: Install SVU
run: |
echo 'deb [trusted=yes] https://apt.fury.io/caarlos0/ /' | sudo tee /etc/apt/sources.list.d/caarlos0.list
sudo apt update && sudo apt install svu
- name: Create Tag
if: endsWith(github.ref, 'main')
run: |
git tag $(svu next --strip-prefix)
git push --tags
- name: Create Preview Tag
if: endsWith(github.ref, 'develop')
run: |
git_hash=$(git rev-parse --short "$GITHUB_SHA")
git_branch=${GITHUB_REF#refs/heads/}
git tag $(svu prerelease --pre-release $git_branch --build $git_hash)
git push --tags
release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21
- name: Release
uses: goreleaser/goreleaser-action@v6
with:
version: latest
distribution: goreleaser
args: release --clean
env:
DEBUG: false
ENABLE_SENTRY_DEBUG: false
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
UNSPLASH_CLIENT_ID: ${{ secrets.CLIENT_ID }}
UNSPLASH_CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}