-
-
Notifications
You must be signed in to change notification settings - Fork 104
119 lines (100 loc) · 3.06 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
name: Build danser
on:
workflow_dispatch:
inputs:
version:
description: 'Danser version'
type: string
required: true
draft:
description: 'Create draft release'
type: boolean
required: false
default: true
jobs:
build_windows:
name: Building windows version
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- name: Checkout master branch
uses: actions/checkout@v3
- name: Install winlibs
uses: bwoodsend/setup-winlibs-action@v1
- name: Install golang
uses: actions/setup-go@v3
with:
go-version: '1.22.4'
cache: true
- name: Build danser
run: |
version="${{ github.event.inputs.version }}"
./dist-win.sh $version
if [ ! -f "dist/artifacts/danser-${version// /-s}-win.zip" ]; then
echo "Danser failed to build"
exit 1
fi
id: build
- name: Upload artifact
uses: actions/upload-artifact@v3
if: ${{ !failure() && steps.build.conclusion != 'failure' }}
with:
name: danser
path: dist/artifacts/*
build_linux:
name: Building linux version
runs-on: ubuntu-20.04
steps:
- name: Checkout master branch
uses: actions/checkout@v3
- name: Install needed packages
run: |
sudo apt-get update
sudo apt-get install xorg-dev libgl1-mesa-dev libgtk-3-dev
- name: Install golang
uses: actions/setup-go@v3
with:
go-version: '1.22.4'
cache: true
- name: Build danser
run: |
version="${{ github.event.inputs.version }}"
chmod +x dist-linux.sh
./dist-linux.sh $version
if [ ! -f "dist/artifacts/danser-${version// /-s}-linux.zip" ]; then
echo "Danser failed to build"
exit 1
fi
id: build
- name: Upload artifact
uses: actions/upload-artifact@v3
if: ${{ !failure() && steps.build.conclusion != 'failure' }}
with:
name: danser
path: dist/artifacts/*
publish_release:
name: Publish draft release
if: ${{ !cancelled() && needs.build_windows.result == 'success' && needs.build_linux.result == 'success' && github.event.inputs.draft }}
needs: [build_windows, build_linux]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: danser
path: artifacts
- name: Create release
id: create_release
run: |
set -xe
shopt -s nullglob
version="${{ github.event.inputs.version }}"
NAME="${version// / snapshot }"
TAGNAME="${version// /-s}"
gh release create "$TAGNAME" --draft -t "$NAME" --target "master" $(for a in artifacts/*.{zip,tar.xz}; do echo $a; done)
env:
GITHUB_TOKEN: ${{ github.token }}