forked from dedis/d-voting
-
Notifications
You must be signed in to change notification settings - Fork 1
148 lines (122 loc) · 4.32 KB
/
releases.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Releases
on:
release:
types: [published]
jobs:
dvoting:
name: release dvoting and .deb
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: Use Go 1.20
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Install fpm
run: |
sudo apt-get update
sudo apt-get install ruby-dev build-essential
sudo gem install fpm -f
- name: build artifacts
# builds the binary and the .deb
run: make deb
- name: Publish release to aptly
env:
APTLY_USER: ${{ secrets.APTLY_USER }}
APTLY_PASSWORD: ${{ secrets.APTLY_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
./deb-package/upload-artifacts.sh deb-package/dist
- name: Update artifacts to Github's release
uses: softprops/action-gh-release@v1
with:
files: |
dvoting-*
deb-package/dist/*
backend:
name: release the web backend
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./web/backend
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Get the version
id: get_version
run: |
echo ::set-output name=version::$(echo ${GITHUB_REF/refs\/tags\//})
echo ::set-output name=version_file::web-backend-$(echo ${GITHUB_REF/refs\/tags\//} | tr . _)
echo "::set-output name=shortsha::$(git rev-parse --short ${GITHUB_SHA})"
echo "::set-output name=buildurl::${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}"
echo "::set-output name=date::$(date +'%d/%m/%y %H:%M')"
- name: install
run: |
npm install
- name: transpile
env:
NODE_ENV: production
run: |
./node_modules/.bin/tsc --outDir ./build/
- name: Pack folder
run: |
npm prune --production
mkdir ${{ steps.get_version.outputs.version_file }}
cd ${{ steps.get_version.outputs.version_file }}
cp -r ../build/* .
cp -r ../node_modules .
cp -r ../config.env.template .
- name: Create tar.gz
run: |
tar -czvf ${{ steps.get_version.outputs.version_file }}.tar.gz ${{ steps.get_version.outputs.version_file }}
- name: Upload release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: web/backend/${{ steps.get_version.outputs.version_file }}.tar.gz
fontend:
name: release the web frontend
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./web/frontend
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Get the version
id: get_version
run: |
echo ::set-output name=version::$(echo ${GITHUB_REF/refs\/tags\//})
echo ::set-output name=version_file::web-frontend-$(echo ${GITHUB_REF/refs\/tags\//} | tr . _)
echo "::set-output name=shortsha::$(git rev-parse --short ${GITHUB_SHA})"
echo "::set-output name=buildurl::${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}"
echo "::set-output name=date::$(date +'%d/%m/%y %H:%M')"
- name: install
run: |
npm install
- name: save config variables
run: |
echo "REACT_APP_VERSION=${{ steps.get_version.outputs.version }}" >> .env.production
echo "REACT_APP_BUILD=${{ steps.get_version.outputs.shortsha }}" >> .env.production
echo "REACT_APP_BUILD_TIME=${{ steps.get_version.outputs.date }}" >> .env.production
- name: transpile
env:
NODE_ENV: production
HTTPS: true
BUILD_PATH: ./build/
CI: false
run: |
./node_modules/.bin/react-scripts build
- name: Create tar.gz
run: |
tar -czvf ${{ steps.get_version.outputs.version_file }}.tar.gz ./build
- name: Upload release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: web/frontend/${{ steps.get_version.outputs.version_file }}.tar.gz