-
-
Notifications
You must be signed in to change notification settings - Fork 33
118 lines (103 loc) · 2.7 KB
/
nightly.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Test
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: write
packages: write
issues: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Install dependencies
run: go mod download
- name: Run tests
run: go test -v .
goreleaser:
runs-on: ubuntu-latest
needs:
- test
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Install Deps
run: |
sudo apt-get install tree git-extras -y
- name: Release config
run: |
cat << EOF > /tmp/goreleaser-github.yaml
project_name: tz
version: 2
builds:
- env: [CGO_ENABLED=0]
goos:
- linux
- windows
- darwin
- freebsd
- openbsd
goarch:
- 386
- amd64
- arm
- arm64
nfpms:
-
maintainer: Arnaud Berthomier <oz@cyprio.net>
bindir: /usr/local/bin
description: A time zone helper
homepage: https://github.com/oz/tz
license: GPL-3
formats:
- deb
- rpm
- apk
- termux.deb
- archlinux
- ipk
EOF
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
# 'latest', 'nightly', or a semver
version: "~> v2"
args: release --clean --verbose --snapshot --config /tmp/goreleaser-github.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: List Dist
run: |
tree dist
- name: Add changelog
run: |
git-changelog -a -x -t >> dist/CHANGELOG.md
- name: Generate artifact name
id: artifact_name
run: |
REPO_NAME=${GITHUB_REPOSITORY##*/}
SHORT_SHA=${GITHUB_SHA::7}
ARTIFACT_NAME="${REPO_NAME}-${GITHUB_REF_NAME}-${SHORT_SHA}"
echo "name=$ARTIFACT_NAME" >> $GITHUB_OUTPUT
- name: Upload Dist
uses: actions/upload-artifact@v4
with:
name: ${{ steps.artifact_name.outputs.name }}
path: dist/*
retention-days: 14