dc/.gitea/workflows/release.yaml

117 lines
4.0 KiB
YAML
Raw Normal View History

2023-07-13 11:44:05 +00:00
name: Release
run-name: Releasing DC
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Write .npmrc file
run: |
echo "$NPMRC" > client/.npmrc
echo "legacy-peer-deps=true" >> client/.npmrc
shell: bash
env:
NPMRC: ${{ secrets.NPMRC}}
- name: Install ZIP and SASjs CLI
2023-07-13 11:44:05 +00:00
run: |
apt-get update
2023-07-25 13:45:11 +00:00
apt-get install zip -y
npm i -g @sasjs/cli
2023-07-13 11:44:05 +00:00
- name: Install JQ for parsing JSON
2023-07-13 11:44:05 +00:00
run: |
apt-get update
2023-07-25 13:45:11 +00:00
apt-get install jq -y
2023-07-13 11:44:05 +00:00
- name: Install Semantic Release and plugins and create Release
2023-07-13 11:44:05 +00:00
run: |
npm i
npm i -g semantic-release
GITEA_TOKEN=${{ secrets.RELEASE_TOKEN }} GITEA_URL=https://git.datacontroller.io semantic-release
2023-07-13 11:44:05 +00:00
2023-07-25 13:45:11 +00:00
- name: Frontend Build
run: |
cd client
npm ci
npm run build
- name: Build SAS9 EBI Release
description: compile SAS 9 services, remove tests & create deployment program
2023-07-13 11:44:05 +00:00
run: |
cd sas
npm ci
sasjs c -t sas9
rm -rf sasjsbuild/tests
sasjs b -t sas9
cp sasjsbuild/mysas9deploy.sas ./demostream_sas9.sas
#
# remove streamed component and rebuild SAS 9 services
#
rm -rf sasjsbuild/services/web9
rm sasjsbuild/services/clickme.sas
sasjs b -t sas9
cp sasjsbuild/mysas9deploy.sas ./sas9.sas
- name: Build SASjs Server Release
description: compile Base (SASjs) services, remove tests & create deployment JSON
run: |
cd sas
cp sasjs/utils/favicon.ico ../client/dist/favicon.ico
sasjs c -t server
rm -rf sasjsbuild/tests
sasjs b -t server
cp sasjsbuild/server.json.zip ./sasjs_server.json.zip
- name: Build Viya Release
description: compile Viya Streaming Deploy (without tests)
run: |
cd sas
sasjs c -t viya
rm -rf sasjsbuild/tests
sed -i -e 's/servertype="SASJS"/servertype="SASVIYA"/g' sasjsbuild/services/clickme.html
sasjs b -t viya
cp sasjsbuild/viya.sas ./demostream_viya.sas
# compile Viya Full deploy (without web)
rm -rf sasjsbuild/services/web
rm sasjsbuild/services/clickme.html
sasjs b -t viya
cp sasjsbuild/viya.sas ./viya.sas
- name: Zip Frontend (including viya.json for full viya deploy)
run: |
cd sas
cp sasjsbuild/viya.json ../client/dist
cd ..
zip -r frontend.zip ./client/dist
2023-07-13 11:44:05 +00:00
- name: Release Typedoc
run: |
cd client
npm run typedoc
# deploy docs
2023-07-25 13:45:11 +00:00
- name: Upload assets to release
run: |
2023-07-25 13:45:11 +00:00
RELEASE_ID=`curl -k 'https://git.datacontroller.io/api/v1/repos/dc/dc/releases/latest?access_token=${{ secrets.RELEASE_TOKEN }}' | jq -r '.id'`
2023-07-26 11:39:04 +00:00
RELEASE_BODY=`curl -k 'https://git.datacontroller.io/api/v1/repos/dc/dc/releases/latest?access_token=${{ secrets.RELEASE_TOKEN }}' | jq -r '.body'`
# Update body
curl --data '{"draft": true,"body":"'"$RELEASE_BODY\n\nFor installation instructions, please visit https://docs.datacontroller.io/"'"}' -X PATCH --header 'Content-Type: application/json' -k https://git.datacontroller.io/api/v1/repos/dc/dc/releases/$RELEASE_ID?access_token=${{ secrets.RELEASE_TOKEN }}
# Upload assets
2023-07-25 13:45:11 +00:00
URL="https://git.datacontroller.io/api/v1/repos/dc/dc/releases/$RELEASE_ID/assets?access_token=${{ secrets.RELEASE_TOKEN }}"
curl -k $URL -F attachment=@frontend.zip
curl -k $URL -F attachment=@sas/demostream_sas9.sas
curl -k $URL -F attachment=@sas/demostream_viya.sas
curl -k $URL -F attachment=@sas/sasjs_server.json.zip
curl -k $URL -F attachment=@sas/sas9.sas
curl -k $URL -F attachment=@sas/viya.sas