Skip to content

Commit 9faabe7

Browse files
authored
Merge pull request #224 from dedis/update-release-action
Adds release actions for web apps
2 parents 0336d26 + 92465e1 commit 9faabe7

File tree

7 files changed

+295
-109
lines changed

7 files changed

+295
-109
lines changed

.github/workflows/go_release.yml

-44
This file was deleted.

.github/workflows/releases.yml

+149
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: Releases
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
memcoin:
9+
name: release memcoin and .deb
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: checkout
14+
uses: actions/checkout@v3
15+
16+
- name: Use go
17+
uses: actions/setup-go@v3
18+
with:
19+
go-version: '>=1.18'
20+
21+
- name: Install fpm
22+
run: |
23+
sudo apt-get update
24+
sudo apt-get install ruby-dev build-essential
25+
sudo gem install fpm -f
26+
27+
- name: build artifacts
28+
# builds the binary and the .deb
29+
run: make deb
30+
31+
- name: Publish release to aptly
32+
env:
33+
APTLY_USER: ${{ secrets.APTLY_USER }}
34+
APTLY_PASSWORD: ${{ secrets.APTLY_PASSWORD }}
35+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
36+
run: |
37+
./deb-package/upload-artifacts.sh deb-package/dist
38+
39+
- name: Update artifacts to Github's release
40+
uses: softprops/action-gh-release@v1
41+
with:
42+
files: |
43+
memcoin-*
44+
deb-package/dist/*
45+
46+
backend:
47+
name: release the web backend
48+
runs-on: ubuntu-latest
49+
50+
defaults:
51+
run:
52+
working-directory: ./web/backend
53+
54+
steps:
55+
- uses: actions/checkout@v3
56+
- uses: actions/setup-node@v3
57+
with:
58+
node-version: 18
59+
60+
- name: Get the version
61+
id: get_version
62+
run: |
63+
echo ::set-output name=version::$(echo ${GITHUB_REF/refs\/tags\//})
64+
echo ::set-output name=version_file::web-backend-$(echo ${GITHUB_REF/refs\/tags\//} | tr . _)
65+
echo "::set-output name=shortsha::$(git rev-parse --short ${GITHUB_SHA})"
66+
echo "::set-output name=buildurl::${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}"
67+
echo "::set-output name=date::$(date +'%d/%m/%y %H:%M')"
68+
69+
- name: install
70+
run: |
71+
npm install
72+
73+
- name: transpile
74+
env:
75+
NODE_ENV: production
76+
run: |
77+
./node_modules/.bin/tsc --outDir ./build/
78+
79+
- name: Pack folder
80+
run: |
81+
npm prune --production
82+
mkdir ${{ steps.get_version.outputs.version_file }}
83+
cd ${{ steps.get_version.outputs.version_file }}
84+
cp -r ../build/* .
85+
cp -r ../node_modules .
86+
cp -r ../dbUtils.js .
87+
cp -r ../config.env.template .
88+
89+
- name: Create tar.gz
90+
run: |
91+
tar -czvf ${{ steps.get_version.outputs.version_file }}.tar.gz ${{ steps.get_version.outputs.version_file }}
92+
93+
- name: Upload release
94+
uses: softprops/action-gh-release@v1
95+
if: startsWith(github.ref, 'refs/tags/')
96+
with:
97+
files: web/backend/${{ steps.get_version.outputs.version_file }}.tar.gz
98+
99+
fontend:
100+
name: release the web frontend
101+
runs-on: ubuntu-latest
102+
103+
defaults:
104+
run:
105+
working-directory: ./web/frontend
106+
107+
steps:
108+
- uses: actions/checkout@v3
109+
- uses: actions/setup-node@v3
110+
with:
111+
node-version: 18
112+
113+
- name: Get the version
114+
id: get_version
115+
run: |
116+
echo ::set-output name=version::$(echo ${GITHUB_REF/refs\/tags\//})
117+
echo ::set-output name=version_file::web-frontend-$(echo ${GITHUB_REF/refs\/tags\//} | tr . _)
118+
echo "::set-output name=shortsha::$(git rev-parse --short ${GITHUB_SHA})"
119+
echo "::set-output name=buildurl::${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}"
120+
echo "::set-output name=date::$(date +'%d/%m/%y %H:%M')"
121+
122+
- name: install
123+
run: |
124+
npm install
125+
126+
- name: save config variables
127+
run: |
128+
echo "REACT_APP_VERSION=${{ steps.get_version.outputs.version }}" >> .env.production
129+
echo "REACT_APP_BUILD=${{ steps.get_version.outputs.shortsha }}" >> .env.production
130+
echo "REACT_APP_BUILD_TIME=${{ steps.get_version.outputs.date }}" >> .env.production
131+
132+
- name: transpile
133+
env:
134+
NODE_ENV: production
135+
HTTPS: true
136+
BUILD_PATH: ./build/
137+
CI: false
138+
run: |
139+
./node_modules/.bin/react-scripts build
140+
141+
- name: Create tar.gz
142+
run: |
143+
tar -czvf ${{ steps.get_version.outputs.version_file }}.tar.gz ./build
144+
145+
- name: Upload release
146+
uses: softprops/action-gh-release@v1
147+
if: startsWith(github.ref, 'refs/tags/')
148+
with:
149+
files: web/frontend/${{ steps.get_version.outputs.version_file }}.tar.gz

0 commit comments

Comments
 (0)