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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
name: CI
on:
push:
branches: [ master ]
tags: "[0-9]+.[0-9]+.[0-9]+"
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set Environment Variables
run: |
echo "LATEST_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
echo "REVISION=$([[ $GITHUB_REF = refs/tags/* ]] && echo 0 || echo 65534)" >> $GITHUB_ENV
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "VERSION=$(git describe --tags --abbrev=0).$([[ $GITHUB_REF = refs/tags/* ]] && echo 0 || echo 65534)-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Web
run: ./bin/build --web-only
- name: Dotnet
run: ./bin/build --dotnet-only --version ${{ env.VERSION }}
- name: Upload Static Web Content
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v2
with:
name: web-${{ env.VERSION }}
path: src/web/build
publish:
name: Build Platform-Specific Binaries
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
runtime: ["win-x64", "linux-x64", "linux-musl-x64", "linux-arm64", "osx-x64"]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set Environment Variables
run: |
echo "LATEST_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
echo "REVISION=$([[ $GITHUB_REF = refs/tags/* ]] && echo 0 || echo 65534)" >> $GITHUB_ENV
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "VERSION=$(git describe --tags --abbrev=0).$([[ $GITHUB_REF = refs/tags/* ]] && echo 0 || echo 65534)-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Download Static Web Content
uses: actions/download-artifact@v2
with:
name: web-${{ env.VERSION }}
path: src/slskd/wwwroot
- name: Build ${{ matrix.runtime }}
run: bin/publish --no-prebuild --runtime ${{ matrix.runtime }} --version ${{ env.VERSION }}
- name: Upload Binaries
uses: actions/upload-artifact@v2
with:
name: slskd-${{ env.VERSION }}-${{ matrix.runtime }}
path: dist/${{ matrix.runtime }}
docker:
name: Build Docker Image
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set Environment Variables
run: |
echo "LATEST_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
echo "REVISION=$([[ $GITHUB_REF = refs/tags/* ]] && echo 0 || echo 65534)" >> $GITHUB_ENV
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "VERSION=$(git describe --tags --abbrev=0).$([[ $GITHUB_REF = refs/tags/* ]] && echo 0 || echo 65534)-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Build
run: docker build -t slskd/slskd:${{ env.VERSION }} --build-arg VERSION=${{ env.VERSION }} .
- name: Tag (Canary)
run: docker tag slskd/slskd:${{ env.VERSION }} slskd/slskd:canary
- name: Tag (Release)
if: startsWith(github.ref, 'refs/tags/')
run: |
docker tag slskd/slskd:${{ env.VERSION }} slskd/slskd:${{ env.LATEST_TAG }}
docker tag slskd/slskd:${{ env.VERSION }} slskd/slskd:latest
- name: Login
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Push Image
run: docker push slskd/slskd:${{ env.VERSION }}
- name: Push Tag (Canary)
run: docker push slskd/slskd:canary
- name: Push Tag (Release)
if: startsWith(github.ref, 'refs/tags/')
run: |
docker push slskd/slskd:${{ env.LATEST_TAG }}
docker push slskd/slskd:latest
release:
name: Create Release
runs-on: ubuntu-latest
needs: [publish, docker]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set Environment Variables
run: |
echo "LATEST_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
echo "REVISION=$([[ $GITHUB_REF = refs/tags/* ]] && echo 0 || echo 65534)" >> $GITHUB_ENV
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "VERSION=$(git describe --tags --abbrev=0).$([[ $GITHUB_REF = refs/tags/* ]] && echo 0 || echo 65534)-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Download win-x64 Binaries
uses: actions/download-artifact@v2
with:
name: slskd-${{ env.VERSION }}-win-x64
path: dist/win-x64
- name: Zip win-x64 Binaries
run: |
cd dist/win-x64
zip -r ../../slskd-${{ env.LATEST_TAG }}-win-x64.zip .
- name: Download linux-x64 Binaries
uses: actions/download-artifact@v2
with:
name: slskd-${{ env.VERSION }}-linux-x64
path: dist/linux-x64
- name: Zip linux-x64 Binaries
run: |
cd dist/linux-x64
zip -r ../../slskd-${{ env.LATEST_TAG }}-linux-x64.zip .
- name: Download linux-musl-x64 Binaries
uses: actions/download-artifact@v2
with:
name: slskd-${{ env.VERSION }}-linux-musl-x64
path: dist/linux-musl-x64
- name: Zip linux-musl-x64 Binaries
run: |
cd dist/linux-musl-x64
zip -r ../../slskd-${{ env.LATEST_TAG }}-linux-musl-x64.zip .
- name: Download linux-arm64 Binaries
uses: actions/download-artifact@v2
with:
name: slskd-${{ env.VERSION }}-linux-arm64
path: dist/linux-arm64
- name: Zip linux-arm64 Binaries
run: |
cd dist/linux-arm64
zip -r ../../slskd-${{ env.LATEST_TAG }}-linux-arm64.zip .
- name: Download osx-x64 Binaries
uses: actions/download-artifact@v2
with:
name: slskd-${{ env.VERSION }}-osx-x64
path: dist/osx-x64
- name: Zip osx-x64 Binaries
run: |
cd dist/osx-x64
zip -r ../../slskd-${{ env.LATEST_TAG }}-osx-x64.zip .
- name: "Build Changelog"
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v1.4.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
body: ${{ steps.build_changelog.outputs.changelog }}
files: |
slskd-${{ env.LATEST_TAG }}-win-x64.zip
slskd-${{ env.LATEST_TAG }}-linux-x64.zip
slskd-${{ env.LATEST_TAG }}-linux-musl-x64.zip
slskd-${{ env.LATEST_TAG }}-linux-arm64.zip
slskd-${{ env.LATEST_TAG }}-osx-x64.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|