Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
emccorson committed Dec 12, 2023
1 parent 932173d commit 5919374
Showing 1 changed file with 34 additions and 237 deletions.
271 changes: 34 additions & 237 deletions .github/workflows/release-wallet.yml
Original file line number Diff line number Diff line change
@@ -1,281 +1,78 @@
name: Deploy interface and release extension
name: Deploy faucet
on:
workflow_dispatch:
inputs:
REF:
required: true
type: string
default: "main"
NAMADA_INTERFACE_NAMADA_ALIAS:
NAMADA_INTERFACE_FAUCET_API_URL:
required: true
type: string
default: "Namada Testnet"
NAMADA_INTERFACE_NAMADA_CHAIN_ID:
default: "https://faucet.api.heliax.click"
NAMADA_INTERFACE_FAUCET_API_ENDPOINT:
required: true
type: string
NAMADA_INTERFACE_NAMADA_URL:
default: "/api/v1/faucet"
NAMADA_INTERFACE_FAUCET_LIMIT:
required: true
type: string
NAMADA_INTERFACE_COSMOS_ALIAS:
required: false
type: string
default: "Cosmos Testnet"
NAMADA_INTERFACE_COSMOS_CHAIN_ID:
required: false
type: string
NAMADA_INTERFACE_COSMOS_URL:
required: false
type: string
NAMADA_INTERFACE_ETH_ALIAS:
required: false
type: string
default: "Goerli Testnet"
NAMADA_INTERFACE_ETH_CHAIN_ID:
required: false
type: string
NAMADA_INTERFACE_ETH_URL:
required: false
default: "1000"
NAMADA_INTERFACE_PROXY_PORT:
type: string

env:
CI: false
jobs:
setup:
deploy-faucet:
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.set-environment-variables.outputs.VERSION }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ inputs.REF }}

- name: Set environment variables
id: set-environment-variables
- 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: Print workflow inputs
uses: ./.github/actions/print-workflow-inputs

build-interface:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ inputs.REF }}

- name: Install yarn dependencies
uses: ./.github/actions/yarn-cache

- name: Restore Rust cache
uses: ./.github/actions/rust-cache
with:
cache-name: build

- name: Install protoc
run: sudo apt-get install -y protobuf-compiler

- name: Build the interface
working-directory: ./apps/namada-interface
run: yarn build
env:
NAMADA_INTERFACE_NAMADA_ALIAS: ${{ inputs.NAMADA_INTERFACE_NAMADA_ALIAS }}
NAMADA_INTERFACE_NAMADA_CHAIN_ID: ${{ inputs.NAMADA_INTERFACE_NAMADA_CHAIN_ID }}
NAMADA_INTERFACE_NAMADA_URL: ${{ inputs.NAMADA_INTERFACE_NAMADA_URL }}
NAMADA_INTERFACE_COSMOS_ALIAS: ${{ inputs.NAMADA_INTERFACE_COSMOS_ALIAS }}
NAMADA_INTERFACE_COSMOS_CHAIN_ID: ${{ inputs.NAMADA_INTERFACE_COSMOS_CHAIN_ID }}
NAMADA_INTERFACE_COSMOS_URL: ${{ inputs.NAMADA_INTERFACE_COSMOS_URL }}
NAMADA_INTERFACE_ETH_ALIAS: ${{ inputs.NAMADA_INTERFACE_ETH_ALIAS }}
NAMADA_INTERFACE_ETH_CHAIN_ID: ${{ inputs.NAMADA_INTERFACE_ETH_CHAIN_ID }}
NAMADA_INTERFACE_ETH_URL: ${{ inputs.NAMADA_INTERFACE_ETH_URL }}
NAMADA_INTERFACE_EXTENSION_URL: https://github.com/anoma/namada-interface/releases/tag/${{ needs.setup.outputs.VERSION }}/

- uses: actions/upload-artifact@v3
with:
name: namada-interface
path: ./apps/namada-interface/build

build-extension-chrome:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ inputs.REF }}

- name: Install yarn dependencies
uses: ./.github/actions/yarn-cache

- name: Restore Rust cache
uses: ./.github/actions/rust-cache
with:
cache-name: build

- name: Install protoc
run: sudo apt-get install -y protobuf-compiler

- name: Build WASM dependencies
working-directory: ./apps/extension
run: yarn wasm:build

- name: Build the extension
working-directory: ./apps/extension
run: yarn build:chrome
env:
NAMADA_INTERFACE_NAMADA_ALIAS: ${{ inputs.NAMADA_INTERFACE_NAMADA_ALIAS }}
NAMADA_INTERFACE_NAMADA_CHAIN_ID: ${{ inputs.NAMADA_INTERFACE_NAMADA_CHAIN_ID }}
NAMADA_INTERFACE_NAMADA_URL: ${{ inputs.NAMADA_INTERFACE_NAMADA_URL }}
NAMADA_INTERFACE_COSMOS_ALIAS: ${{ inputs.NAMADA_INTERFACE_COSMOS_ALIAS }}
NAMADA_INTERFACE_COSMOS_CHAIN_ID: ${{ inputs.NAMADA_INTERFACE_COSMOS_CHAIN_ID }}
NAMADA_INTERFACE_COSMOS_URL: ${{ inputs.NAMADA_INTERFACE_COSMOS_URL }}
NAMADA_INTERFACE_ETH_ALIAS: ${{ inputs.NAMADA_INTERFACE_ETH_ALIAS }}
NAMADA_INTERFACE_ETH_CHAIN_ID: ${{ inputs.NAMADA_INTERFACE_ETH_CHAIN_ID }}
NAMADA_INTERFACE_ETH_URL: ${{ inputs.NAMADA_INTERFACE_ETH_URL }}

- uses: actions/upload-artifact@v3
with:
name: namada-extension-chrome
path: ./apps/extension/build/chrome/namada_extension-*.zip

build-extension-firefox:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ inputs.REF }}

- name: Install yarn dependencies
uses: ./.github/actions/yarn-cache

- name: Restore Rust cache
uses: ./.github/actions/rust-cache
with:
cache-name: build

- name: Install protoc
run: sudo apt-get install -y protobuf-compiler

- name: Build WASM dependencies
working-directory: ./apps/extension
run: yarn wasm:build

- name: Build the extension
working-directory: ./apps/extension
run: yarn build:firefox
- 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:
NAMADA_INTERFACE_NAMADA_ALIAS: ${{ inputs.NAMADA_INTERFACE_NAMADA_ALIAS }}
NAMADA_INTERFACE_NAMADA_CHAIN_ID: ${{ inputs.NAMADA_INTERFACE_NAMADA_CHAIN_ID }}
NAMADA_INTERFACE_NAMADA_URL: ${{ inputs.NAMADA_INTERFACE_NAMADA_URL }}
NAMADA_INTERFACE_COSMOS_ALIAS: ${{ inputs.NAMADA_INTERFACE_COSMOS_ALIAS }}
NAMADA_INTERFACE_COSMOS_CHAIN_ID: ${{ inputs.NAMADA_INTERFACE_COSMOS_CHAIN_ID }}
NAMADA_INTERFACE_COSMOS_URL: ${{ inputs.NAMADA_INTERFACE_COSMOS_URL }}
NAMADA_INTERFACE_ETH_ALIAS: ${{ inputs.NAMADA_INTERFACE_ETH_ALIAS }}
NAMADA_INTERFACE_ETH_CHAIN_ID: ${{ inputs.NAMADA_INTERFACE_ETH_CHAIN_ID }}
NAMADA_INTERFACE_ETH_URL: ${{ inputs.NAMADA_INTERFACE_ETH_URL }}

- uses: actions/upload-artifact@v3
with:
name: namada-extension-firefox
path: ./apps/extension/build/firefox/namada_extension-*.zip
JSON_INPUTS: ${{ toJSON(github.event.inputs) }}

release:
needs:
[setup, build-interface, build-extension-chrome, build-extension-firefox]
runs-on: ubuntu-latest
steps:
- name: Download interface build
uses: actions/download-artifact@v3
with:
name: namada-interface
path: ./namada-interface

- name: Download Chrome extension build
uses: actions/download-artifact@v3
with:
name: namada-extension-chrome
path: ./namada-extension-chrome

- name: Download Firefox extension build
uses: actions/download-artifact@v3
with:
name: namada-extension-firefox
path: ./namada-extension-firefox

- name: Get extension filenames
id: get-filenames
run: |
echo "CHROME_FILENAME=$(ls -1 ./namada-extension-chrome)" >> "$GITHUB_OUTPUT"
echo "FIREFOX_FILENAME=$(ls -1 ./namada-extension-firefox)" >> "$GITHUB_OUTPUT"
- name: Build the faucet
working-directory: ./apps/faucet
run: yarn build

- name: Deploy interface to Netlify
- name: Deploy the faucet to Netlify
uses: nwtgck/[email protected]
with:
publish-dir: ./namada-interface
publish-dir: ./apps/faucet/build
production-branch: main
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Deployed release ${{ needs.setup.outputs.VERSION }}"
deploy-message: "Deployed faucet ${{ steps.get-version-string.outputs.VERSION }}"
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_ACCESS_TOKEN_WALLET_PREVIEW }}
NETLIFY_SITE_ID: 2380782e-9b20-477a-bc27-b4e9d05e16f3

- name: Make release body text
run: |
echo "NAMADA_INTERFACE_NAMADA_ALIAS: $NAMADA_INTERFACE_NAMADA_ALIAS" >> RELEASE
echo "NAMADA_INTERFACE_NAMADA_CHAIN_ID: $NAMADA_INTERFACE_NAMADA_CHAIN_ID" >> RELEASE
echo "NAMADA_INTERFACE_NAMADA_URL: $NAMADA_INTERFACE_NAMADA_URL" >> RELEASE
echo "NAMADA_INTERFACE_COSMOS_ALIAS: $NAMADA_INTERFACE_COSMOS_ALIAS" >> RELEASE
echo "NAMADA_INTERFACE_COSMOS_CHAIN_ID: $NAMADA_INTERFACE_COSMOS_CHAIN_ID" >> RELEASE
echo "NAMADA_INTERFACE_COSMOS_URL: $NAMADA_INTERFACE_COSMOS_URL" >> RELEASE
echo "NAMADA_INTERFACE_ETH_ALIAS: $NAMADA_INTERFACE_ETH_ALIAS" >> RELEASE
echo "NAMADA_INTERFACE_ETH_CHAIN_ID: $NAMADA_INTERFACE_ETH_CHAIN_ID" >> RELEASE
echo "NAMADA_INTERFACE_ETH_URL: $NAMADA_INTERFACE_ETH_URL" >> RELEASE
env:
NAMADA_INTERFACE_NAMADA_ALIAS: ${{ inputs.NAMADA_INTERFACE_NAMADA_ALIAS }}
NAMADA_INTERFACE_NAMADA_CHAIN_ID: ${{ inputs.NAMADA_INTERFACE_NAMADA_CHAIN_ID }}
NAMADA_INTERFACE_NAMADA_URL: ${{ inputs.NAMADA_INTERFACE_NAMADA_URL }}
NAMADA_INTERFACE_COSMOS_ALIAS: ${{ inputs.NAMADA_INTERFACE_COSMOS_ALIAS }}
NAMADA_INTERFACE_COSMOS_CHAIN_ID: ${{ inputs.NAMADA_INTERFACE_COSMOS_CHAIN_ID }}
NAMADA_INTERFACE_COSMOS_URL: ${{ inputs.NAMADA_INTERFACE_COSMOS_URL }}
NAMADA_INTERFACE_ETH_ALIAS: ${{ inputs.NAMADA_INTERFACE_ETH_ALIAS }}
NAMADA_INTERFACE_ETH_CHAIN_ID: ${{ inputs.NAMADA_INTERFACE_ETH_CHAIN_ID }}
NAMADA_INTERFACE_ETH_URL: ${{ inputs.NAMADA_INTERFACE_ETH_URL }}

- name: Create release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
release_name: ${{ needs.setup.outputs.VERSION }}
tag_name: ${{ needs.setup.outputs.VERSION }}
body_path: ./RELEASE

- name: Add Chrome extension to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ./namada-extension-chrome/${{ steps.get-filenames.outputs.CHROME_FILENAME }}
asset_name: namada-extension-chrome_${{ needs.setup.outputs.VERSION }}.zip
asset_content_type: application/zip

- name: Add Firefox extension to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ./namada-extension-firefox/${{ steps.get-filenames.outputs.FIREFOX_FILENAME }}
asset_name: namada-extension-firefox_${{ needs.setup.outputs.VERSION }}.zip
asset_content_type: application/zip
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_FAUCET_SITE_ID }}

1 comment on commit 5919374

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.