-
-
Notifications
You must be signed in to change notification settings - Fork 39
162 lines (137 loc) · 4.36 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
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: Release F2
env:
dev_tag: nightly
go_version: 1.23
REPO_OWNER: ${{ vars.REPO_OWNER }}
REPO_WEBSITE: ${{ vars.REPO_WEBSITE }}
REPO_DESCRIPTION: ${{ vars.REPO_DESCRIPTION }}
REPO_MAINTAINER: ${{ vars.REPO_MAINTAINER }}
REPO_AUTHOR_NAME: ${{ vars.REPO_AUTHOR_NAME }}
REPO_AUTHOR_EMAIL: ${{ vars.REPO_AUTHOR_EMAIL }}
REPO_BINARY_NAME: ${{ vars.REPO_BINARY_NAME }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
on:
workflow_dispatch:
push:
branches:
- master
tags:
- v*
pull_request:
jobs:
create_tag_master:
name: Create nightly tag for master branch
runs-on: ubuntu-latest
if: github.ref_type == 'branch'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update nightly tag
run: |
git tag -d ${{ env.dev_tag }} || true
git push origin :refs/tags/${{ env.dev_tag }} || true
git tag ${{ env.dev_tag }}
git push origin ${{ env.dev_tag }}
publish_nightly:
needs: create_tag_master
name: Release nightly version
runs-on: ubuntu-latest
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go ${{ env.go_version }}
uses: actions/setup-go@v5
with:
go-version: ${{ env.go_version }}
- name: Delete existing nightly release
run: |
gh release delete nightly --yes || true
- name: Create nightly release
uses: softprops/action-gh-release@v2
with:
tag_name: refs/tags/${{ env.dev_tag }}
name: Development build (master)
body: |
This build is directly sourced from the `master` branch in active development. As such, it may include experimental features and potential bugs.
draft: false
prerelease: true
- name: Build assets with Goreleaser
uses: goreleaser/goreleaser-action@v6
with:
version: ~> v2
args: release --clean --snapshot
- name: Upload assets to nightly release
run: gh release upload ${{ env.dev_tag }} dist/{*.tar.gz,*.zip,*.tar.zst,*.deb,*.rpm,*.apk,checksums.txt} --clobber
run_tests:
runs-on: ${{ matrix.os }}
if: github.ref_type == 'tag'
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.23
- name: Use Exiftool
uses: woss/[email protected]
if: matrix.os != 'windows-latest'
- uses: MinoruSekine/[email protected]
with:
apps: exiftool
if: matrix.os == 'windows-latest'
- name: Set up gotestfmt
run: go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
- name: Run tests
run: go test ./... -json -v -race 2>&1 | gotestfmt -hide 'empty-packages'
publish_stable:
name: Release stable version
runs-on: ubuntu-latest
needs: run_tests
if: github.ref_type == 'tag'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go ${{ env.go_version }}
uses: actions/setup-go@v5
with:
go-version: ${{ env.go_version }}
- name: Create stable release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref }}
name: ${{ github.ref }}
body: ${{ env.CHANGELOG }}
draft: false
prerelease: false
- name: Run Goreleaser
uses: goreleaser/goreleaser-action@v6
with:
version: ~> v2
args: release --clean
env:
GORELEASER_GITHUB_TOKEN: ${{ secrets.SCOOP_BUCKET_GITHUB_TOKEN }}
FURY_PUSH_TOKEN: ${{ secrets.FURY_PUSH_TOKEN }}
FURY_USERNAME: ${{ secrets.FURY_USERNAME }}
publish_npm:
needs: publish_stable
name: Publish new F2 version
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
registry-url: https://registry.npmjs.org/
node-version: "22"
- name: Publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}