deploy #253
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: deploy | |
on: | |
schedule: | |
- cron: "0 0 */15 * *" # every 15 days | |
push: | |
branches: [master] | |
workflow_dispatch: | |
jobs: | |
deploy: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-20.04 | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Checkout config | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.15 | |
- name: Build deployer executable | |
run: | | |
mkdir ./bin | |
go build -v -o bin ./cmd/webdata | |
- name: Extract service account data | |
run: | | |
echo $SERVICE_ACCOUNT > service_account.json | |
env: | |
SERVICE_ACCOUNT: ${{ secrets.SERVICE_ACCOUNT }} | |
- name: Generate calendar data | |
run: | | |
./bin/webdata semester1.json semester2.json | |
mv -f semester*.json ./web/public/data/ | |
env: | |
GOOGLE_APPLICATION_CREDENTIALS: ./service_account.json | |
- name: Compile WebAssembly wrapper | |
run: go build -o ./web/public/calendar.wasm ./cmd/wasm/main.go | |
env: | |
GOOS: js | |
GOARCH: wasm | |
- name: Set up React build | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 15.x | |
- name: Install React project dependencies | |
run: npm install | |
working-directory: web | |
- name: Build static React site | |
run: npm run build | |
working-directory: web | |
- name: Setup deployment | |
run: | | |
mkdir -p ./publish | |
mv -f web/build/* ./publish/ | |
- name: Deploy | |
uses: peaceiris/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./publish | |
# need to exclude .gitignore as actions-gh-pages wont deploy | |
# ignored files | |
exclude_assets: '.github,**/.gitignore' | |
force_orphan: true |