Skip to content

Deploy faucet

Deploy faucet #5

name: Deploy faucet
on:
workflow_dispatch:
inputs:
REF:
required: true
type: string
default: "main"
NAMADA_INTERFACE_FAUCET_API_URL:
required: true
type: string
default: "https://faucet.api.heliax.click"
NAMADA_INTERFACE_FAUCET_API_ENDPOINT:
required: true
type: string
default: "/api/v1/faucet"
NAMADA_INTERFACE_FAUCET_LIMIT:
required: true
type: string
default: "1000"
NAMADA_INTERFACE_PROXY_PORT:
type: string
env:
CI: false
jobs:
deploy-faucet:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ inputs.REF }}
- name: Print workflow inputs
uses: ./.github/actions/print-workflow-inputs
- name: Get version string
id: get-version-string
working-directory: ./apps/faucet
run: |
COMMIT_HASH=$(git rev-parse --short $SHA)
BASE_VERSION=$(node -e 'console.log(require("./package.json").version)')
echo "VERSION=v$BASE_VERSION-$COMMIT_HASH" >> "$GITHUB_OUTPUT"
echo "VERSION: v$BASE_VERSION-$COMMIT_HASH" >> "$GITHUB_STEP_SUMMARY"
env:
SHA: ${{ github.sha }}
- name: Install yarn dependencies
uses: ./.github/actions/yarn-cache
- name: Write workflow inputs to .env file
working-directory: ./apps/faucet
shell: node {0}
run: |
const fs = require("fs");
const json = JSON.parse(process.env.JSON_INPUTS);
const concatenated = Object.entries(json)
.map(([key, value]) => `${key}=${value}`)
.join("\n");
fs.appendFileSync(".env", concatenated);
env:
JSON_INPUTS: ${{ toJSON(github.event.inputs) }}
- name: Build the faucet
working-directory: ./apps/faucet
run: yarn build
- name: Deploy the faucet to Netlify
uses: nwtgck/[email protected]
with:
publish-dir: ./apps/faucet/build
production-deploy: true
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Deployed faucet ${{ steps.get-version-string.outputs.VERSION }}"
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_ACCESS_TOKEN_WALLET_PREVIEW }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_FAUCET_SITE_ID }}