-
Notifications
You must be signed in to change notification settings - Fork 3
115 lines (99 loc) · 2.73 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
name: release
on:
push:
tags:
- 'v*'
# paths-ignore:
# - 'LICENCE'
# - '*.md'
# branches:
# - main
# - devel
env:
APP_NAME: 'TorCI'
NIM_VERSION: '1.6.0'
MAINTAINER: 'Luca'
DESC: 'Web-based GUI for TorBox'
jobs:
build-artefact:
name: Build artefact
runs-on: ubuntu-latest
strategy:
matrix:
dist:
- debian
codename:
- buster
arch:
- amd64
- arm
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Create artefact
run: |
torci_dir=artefact/torci
mkdir -p $torci_dir
# Set env
ARCH=${{ matrix.arch }}
# Build
docker build -t torci:release -f build/${{ matrix.codename }} build
docker run --rm -v `pwd`:/src/torci -e ARCH=${{ matrix.arch }} torci:release
# Move binary
mv torci $torci_dir
# Copy resources
cp -r public $torci_dir/public
cp torci.nimble torci.conf config.nims LICENCE $torci_dir
archive_name=torci_${{ matrix.arch }}.tar.gz
tar -czvf $archive_name -C artefact torci
shell: bash
- uses: actions/upload-artifact@v2
with:
name: artefact-${{ matrix.dist }}_${{ matrix.arch }}
path: torci_*.tar.gz
create-release:
runs-on: ubuntu-latest
needs:
- build-artefact
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: |
Anyway
draft: false
prerelease: false
- name: upload_url
run: echo "::set-output name=upload_url::${{ steps.create_release.outputs.upload_url }}"
upload-release:
runs-on: ubuntu-latest
needs: create-release
strategy:
matrix:
dist:
- debian
arch:
- amd64
- arm
steps:
- uses: actions/download-artifact@v2
with:
name: artefact-${{ matrix.dist }}_${{ matrix.arch }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: torci_${{ matrix.arch }}.tar.gz
asset_name: torci_${{ matrix.arch }}.tar.gz
asset_content_type: application/tar+gzip