-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (81 loc) · 2.48 KB
/
build.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
name: Build, Integrate & ZIP
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
dist
scripts
key: build-${{ github.sha }}
- name: Read .nvmrc
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT
id: nvm
- name: Use Node.js ${{ steps.nvm.outputs.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
cache: npm
- name: Build 🏭
run: |
npm install
npm run build:prod
cp README.md dist && cp -r doc dist
integrate:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/cache@v4
with:
path: |
dist
scripts
key: build-${{ github.sha }}
- name: Checkout evento-portal
uses: actions/checkout@v4
with:
repository: bkd-mba-fbi/evento-portal
token: ${{ secrets.WEBAPP_TO_PORTAL_TOKEN }}
path: ./evento-portal
- name: Copy new build to event-portal
run: |
./scripts/copy-to-portal.sh evento-portal/public/apps/webapp-schulverwaltung
- name: Commit and push to evento-portal
run: |
cd ./evento-portal
if [ -z "$(git status -s)" ]; then
echo "Nothing to commit"
else
git config user.name github-actions
git config user.email [email protected]
git add .
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-8)
git commit -m "Add webapp-schulverwaltung build $SHORT_SHA"
git push
fi
zip:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
dist
scripts
key: build-${{ github.sha }}
- name: Zip 🗜️
run: |
(cd dist && zip --recurse-paths webapp-schulverwaltung.zip *)
mv dist/webapp-schulverwaltung dist/app
sed -e "s~https://eventotest.api~$API_URL~g" dist/app/settings.example.js > dist/app/settings.js
- name: Upload
uses: JamesIves/[email protected]
with:
branch: gh-pages # The branch the action should deploy to.
folder: dist # The folder the action should deploy.