-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (58 loc) · 2.08 KB
/
build_to_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
on:
push:
branches: [ development, release ]
pull_request:
branches: [ development, release ]
env:
NODE_VERSION: '20.x' # set this to the node version to use
jobs:
build-and-deploy:
name: Test, Build and Deploy
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- name: Get short commit hash
run: |
commithash=`git rev-parse --short "$GITHUB_SHA"`
echo "gitcommitshort=$commithash" >> $GITHUB_ENV
committext=`git log --oneline -n 1`
echo "gitcommittext=$committext" >> $GITHUB_ENV
- name: npm install, build, and test
run: |
# disable sourcemap generation to reduce memory usage and save build size
echo "GENERATE_SOURCEMAP=false" >> .env
# Build and test the project
npm install
npm run build --if-present --production
# need to comment out cypress for now since we don't have a backend it can use for testing - we could potentially
# set up a testing service on a dedicated VM
#./node_modules/.bin/cypress run
# npm run test --if-present
# Now take the built item and upload a zip as a release
- name: Make zip of build as artifact and for release
if: github.ref == 'refs/heads/release'
run: |
zip -r release-build.zip dist/*
- name: Attach artifact
uses: actions/upload-artifact@v2
if: github.ref == 'refs/heads/release'
with:
name: release-build
path: dist/*
# create the release, attaching the file
- name: Release
uses: softprops/action-gh-release@v1
if: github.ref == 'refs/heads/release'
with:
name: "${{ env.gitcommittext }}"
body: Automatically generated release on push to release branch.
tag_name: "2022dev-${{ env.gitcommitshort }}"
files: |
release-build.zip
env:
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}