-
-
Notifications
You must be signed in to change notification settings - Fork 734
127 lines (108 loc) · 4.11 KB
/
build.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
name: Build
on:
pull_request:
branches:
- "main"
- "*/main/*/**"
push:
branches:
- "main"
- "*/main/*/**"
release:
types: [published]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Build
run: go build .
- name: Format
run: |
gofmt -s -l .
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi
release:
permissions:
id-token: write
contents: write
attestations: write
name: Release
strategy:
matrix:
os: ["linux", "darwin", "windows"]
arch: ["amd64", "arm64", "386"]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v2')
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get Tag
run: echo "TAG=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
- name: Is Unix Platform
run: echo "IS_UNIX=${{ matrix.os != 'windows' && matrix.arch != '386' }}" >> $GITHUB_ENV
- name: Is Windows Platform
run: echo "IS_WIN=${{ matrix.os == 'windows' }}" >> $GITHUB_ENV
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Build
if: env.IS_UNIX == 'true' || env.IS_WIN == 'true'
run: |
go build -ldflags "-X main.version=${{ env.TAG }}" -o "./spicetify${{ matrix.os == 'windows' && '.exe' || '' }}"
chmod +x "./spicetify${{ matrix.os == 'windows' && '.exe' || '' }}"
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
CGO_ENABLED: 0
- name: Attest output
uses: actions/attest-build-provenance@v1
if: env.IS_UNIX == 'true' || env.IS_WIN == 'true'
with:
subject-path: "./spicetify${{ matrix.os == 'windows' && '.exe' || '' }}"
subject-name: "spicetify v${{ env.TAG }} (${{ matrix.os }}, ${{ (matrix.os == 'windows' && matrix.arch == 'amd64' && 'x64') || (matrix.os == 'windows' && matrix.arch == '386' && 'x32') || matrix.arch }})"
- name: 7z - .tar
if: env.IS_UNIX == 'true'
uses: edgarrc/action-7z@v1
with:
args: 7z a -bb0 "spicetify-${{ env.TAG }}-${{ matrix.os }}-${{ matrix.arch }}.tar" "./spicetify" "./CustomApps" "./Extensions" "./Themes" "./jsHelper" "globals.d.ts" "css-map.json"
- name: 7z - .tar.gz
if: env.IS_UNIX == 'true'
uses: edgarrc/action-7z@v1
with:
args: 7z a -bb0 -sdel -mx9 "spicetify-${{ env.TAG }}-${{ matrix.os }}-${{ matrix.arch }}.tar.gz" "spicetify-${{ env.TAG }}-${{ matrix.os }}-${{ matrix.arch }}.tar"
- name: 7z - .zip
if: env.IS_WIN == 'true'
uses: edgarrc/action-7z@v1
with:
args: 7z a -bb0 -mx9 "spicetify-${{ env.TAG }}-${{ matrix.os }}-${{ (matrix.arch == 'amd64' && 'x64') || (matrix.arch == 'arm64' && 'arm64') || 'x32' }}.zip" "./spicetify.exe" "./CustomApps" "./Extensions" "./Themes" "./jsHelper" "globals.d.ts" "css-map.json"
- name: Release
if: env.IS_UNIX == 'true' || env.IS_WIN == 'true'
uses: softprops/action-gh-release@v2
with:
files: "spicetify-${{ env.TAG }}-${{ matrix.os }}-${{ (matrix.os == 'windows' && matrix.arch == 'amd64' && 'x64') || (matrix.os == 'windows' && matrix.arch == '386' && 'x32') || matrix.arch }}.${{ matrix.os == 'windows' && 'zip' || 'tar.gz' }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
trigger-release:
name: Trigger Homebrew/AUR Release
runs-on: ubuntu-latest
needs: release
steps:
- name: Update AUR package
uses: fjogeleit/http-request-action@master
with:
url: https://vps.itsmeow.dev/spicetify-update
method: GET
- name: Update Winget package
uses: vedantmgoyal9/winget-releaser@main
with:
identifier: Spicetify.Spicetify
installers-regex: '-windows-\w+\.zip$'
token: ${{ secrets.SPICETIFY_WINGET_TOKEN }}