Deploy Number Guessing Game v2 #46
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 Number Guessing Game v2 | |
on: | |
workflow_dispatch: | |
inputs: | |
address: | |
description: "Contract Address" | |
required: true | |
competition_address: | |
description: "Competition Contract Address" | |
required: true | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
- name: Install dependencies | |
run: npm install | |
working-directory: ./guessing-game-v2 | |
- name: Write Address to JSON | |
run: | | |
echo '{"address": "${{ github.event.inputs.address }}"}' > ./guessing-game-v2/src/assets/contract/address.json | |
echo '{"competition_address": "${{ github.event.inputs.competition_address }}"}' > ./guessing-game-v2/src/assets/contract/competition_address.json | |
- name: Build application | |
run: npm run build | |
working-directory: ./guessing-game-v2 | |
env: # Or as an environment variable | |
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./guessing-game-v2/dist | |
destination_dir: ./guessing-game-v2 |