Skip to content

v0.6.5

v0.6.5 #42

Workflow file for this run

name: Release
on:
push:
branches: [main]
release:
types: [published]
jobs:
pre-deploy:
runs-on: ubuntu-latest
steps:
- id: set-up-environment
name: Set up environment
run: |
target_staging=${{ github.ref == 'refs/heads/main' }}
target_production=${{ startsWith(github.ref, 'refs/tags/') }}
if [[ "$target_staging" == "true" ]]; then
echo "environment=Staging" >> $GITHUB_OUTPUT
exit 0
fi
if [[ "$target_production" == "true" ]]; then
echo "environment=Production" >> $GITHUB_OUTPUT
exit 0
fi
echo "Encounter unknown situation. Abort."
exit 1
outputs:
environment: ${{ steps.set-up-environment.outputs.environment }}
build-and-deploy:
runs-on: ubuntu-latest
needs:
- pre-deploy
environment: ${{ needs.pre-deploy.outputs.environment }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.x
- id: yarn-cache-dir-path
name: Get yarn cache directory path
run: echo "::set-output name=dir::$(yarn cache dir)"
- id: yarn-cache
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Show yarn version
run: yarn --version
- name: Install and build
run: |
yarn install
yarn build
- uses: JamesIves/[email protected]
if: ${{ needs.pre-deploy.outputs.environment == 'Production' }}
with:
branch: gh-pages
folder: build
- uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: build
target-folder: staging