better compatibility with mozilla #31
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: build-pages | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
build_branch: | |
type: string | |
default: build/public | |
jobs: | |
build: | |
environment: TESTNET | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: validate branch | |
if: ${{ inputs.build_branch == 'main' }} | |
run: | | |
echo 'cannot target main branch' \ | |
&& exit 1 | |
- name: prepare env | |
run: | | |
echo "PUBLIC_RPC_URL=${{ vars.PUBLIC_ETHEREUM_RPC }}" >> $GITHUB_ENV \ | |
&& echo "PUBLIC_CHAIN_ID=${{ vars.PUBLIC_CHAIN_ID }}" >> $GITHUB_ENV \ | |
&& echo "PUBLIC_CONTEST_ADDRESS=${{ vars.PUBLIC_CONTEST_ADDRESS }}" >> $GITHUB_ENV \ | |
&& echo "PUBLIC_GH_CLIENT_ID=${{ vars.PUBLIC_GH_CLIENT_ID }}" >> $GITHUB_ENV \ | |
&& echo "PUBLIC_PROJECT_ID=${{ vars.PUBLIC_PROJECT_ID }}" >> $GITHUB_ENV \ | |
&& echo "PUBLIC_REGISTRAR_URL=${{ vars.PUBLIC_REGISTRAR_URL }}" >> $GITHUB_ENV \ | |
&& echo "PUBLIC_DATA_URL=${{ vars.PUBLIC_DATA_URL }}" >> $GITHUB_ENV \ | |
&& echo "PUBLIC_INVITE_ONLY=${{ vars.PUBLIC_INVITE_ONLY }}" >> $GITHUB_ENV \ | |
&& echo "PUBLIC_SEASON_DURATION_SECONDS=${{ vars.PUBLIC_SEASON_DURATION_SECONDS }}" >> $GITHUB_ENV \ | |
&& echo "PUBLIC_MAINTENANCE_MODE=${{ vars.PUBLIC_MAINTENANCE_MODE }}" >> $GITHUB_ENV | |
- name: install deps | |
run: npm i --include=dev | |
- name: build | |
env: | |
BASE_PATH: '' | |
run: | | |
npm run build | |
touch build/.nojekyll | |
- name: commit | |
run: | | |
git checkout -f --orphan ${{ inputs.build_branch || 'build/public' }} \ | |
&& git reset \ | |
&& echo "${{ vars.CNAME }}" >> 'build/CNAME' \ | |
&& git add -f build \ | |
&& git config user.name 'github-actions' \ | |
&& git config user.email '[email protected]' \ | |
&& git commit -m 'build' \ | |
&& git subtree split --prefix build -b tmp \ | |
&& git push -f -u origin tmp:${{ inputs.build_branch || 'build/public' }} | |