blob: dca7cc71dbfc41b1d06be46b1e2790cf6e397062 (
plain) (
blame)
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
|
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:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set Environment Variables
run: |
echo "LATEST_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Web
run: ./bin/build --web-only
- name: Dotnet
run: ./bin/build --dotnet-only --version ${{ env.LATEST_TAG }}-${{ env.SHORT_SHA }}
- name: Upload Static Web Content
uses: actions/upload-artifact@v2
with:
name: web
path: src/web/build
publish:
name: Publish Build Artifacts
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:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set Environment Variables
run: |
echo "LATEST_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: actions/download-artifact@v2
with:
name: web
path: src/slskd/wwwroot
- name: Publish ${{ matrix.runtime }}
run: bin/publish --no-prebuild --runtime ${{ matrix.runtime }} --version ${{ env.LATEST_TAG }}-${{ env.SHORT_SHA }}
- name: Upload a Build Artifact
uses: actions/upload-artifact@v2
with:
name: slskd-${{ env.LATEST_TAG }}.${{ env.SHORT_SHA }}-${{ 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:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set Environment Variables
run: |
echo "LATEST_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Build
run: docker build -t slskd/slskd:${{ env.LATEST_TAG }}.${{ env.SHORT_SHA }} --build-arg VERSION=${{ env.LATEST_TAG }} --build-arg SHA=${{ env.SHORT_SHA }} .
- name: Tag (Canary)
run: docker tag slskd/slskd:${{ env.LATEST_TAG }}.${{ env.SHORT_SHA }} slskd/slskd:canary
- name: Tag (Release)
if: startsWith(github.ref, 'refs/tags/')
run: |
docker tag slskd/slskd:${{ env.LATEST_TAG }}.${{ env.SHORT_SHA }} slskd/slskd:${{ env.LATEST_TAG }}.0
docker tag slskd/slskd:${{ env.LATEST_TAG }}.${{ env.SHORT_SHA }} 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.LATEST_TAG }}.${{ env.SHORT_SHA }}
- 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 }}.0
docker push slskd/slskd:latest
release:
name: Create Release
runs-on: ubuntu-latest
needs: [publish, docker]
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set Environment Variables
run: |
echo "LATEST_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: actions/download-artifact@v2
with:
name: slskd-${{ env.LATEST_TAG }}.${{ env.SHORT_SHA }}-win-x64
path: dist/win-x64
- name: Zip win-x64
run: |
cd dist/win-x64
zip -r ../../slskd-${{ env.LATEST_TAG }}-win-x64.zip .
- uses: actions/download-artifact@v2
with:
name: slskd-${{ env.LATEST_TAG }}.${{ env.SHORT_SHA }}-linux-x64
path: dist/linux-x64
- name: Zip linux-x64
run: |
cd dist/linux-x64
zip -r ../../slskd-${{ env.LATEST_TAG }}-linux-x64.zip .
- uses: actions/download-artifact@v2
with:
name: slskd-${{ env.LATEST_TAG }}.${{ env.SHORT_SHA }}-linux-musl-x64
path: dist/linux-musl-x64
- name: Zip linux-musl-x64
run: |
cd dist/linux-musl-x64
zip -r ../../slskd-${{ env.LATEST_TAG }}-linux-musl-x64.zip .
- uses: actions/download-artifact@v2
with:
name: slskd-${{ env.LATEST_TAG }}.${{ env.SHORT_SHA }}-linux-arm64
path: dist/linux-arm64
- name: Zip linux-arm64
run: |
cd dist/linux-arm64
zip -r ../../slskd-${{ env.LATEST_TAG }}-linux-arm64.zip .
- uses: actions/download-artifact@v2
with:
name: slskd-${{ env.LATEST_TAG }}.${{ env.SHORT_SHA }}-osx-x64
path: dist/osx-x64
- name: Zip osx-x64
run: |
cd dist/osx-x64
zip -r ../../slskd-${{ env.LATEST_TAG }}-osx-x64.zip .
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
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 }}
|