Skip to content

pls deploy []

pls deploy [] #1

name: Deploy wallet preview on request
on:
issue_comment:
types: [created]
env:
CI: false
jobs:
deploy_on_request:
runs-on: ubuntu-latest
steps:
- name: Check if deployment is requested
id: check-comment
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const keywords = ["pls deploy"];
const comment = context.payload.comment.body;
const matches = keywords.some(keyword => comment.includes(keyword));
return { matches };
- name: Trigger workflow if deployment is requested
if: steps.check-comment.outputs.matches == true
run: |
# Extract environment variable values from the comment
# Example comment: "pls deploy [Namada Devnet, internal-devnet-6be.86067e06a5, https://proxy.heliax.click/internal-devnet-6be.86067e06a5]"
# Note: Make sure the comment format matches the pattern below
comment_text="${{ github.event.comment.body }}"
env_vars=$(echo "$comment_text" | sed 's/^.*\[\(.*\)\].*$/\1/' | tr -d '[]')
IFS=', ' read -ra env_values <<< "$env_vars"
alias="${env_values[0]}"
chain_id="${env_values[1]}"
url="${env_values[2]}"
# Set environment variables for the workflow
echo "REACT_APP_NAMADA_ALIAS=$alias" >> $GITHUB_ENV
echo "REACT_APP_NAMADA_CHAIN_ID=$chain_id" >> $GITHUB_ENV
echo "REACT_APP_NAMADA_URL=$url" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v3
- name: Install dependencies
working-directory: ./apps/namada-interface
run: yarn
- name: Install protoc
run: sudo apt-get install -y protobuf-compiler
- name: Install wasm-pack
uses: jetli/wasm-pack-action@v0.3.0
with:
version: "v0.10.3"
- name: build the site
uses: borales/actions-yarn@v4
working-directory: ./apps/namada-interface
run: yarn build
env:
REACT_APP_NAMADA_ALIAS: "Namada Devnet"
REACT_APP_NAMADA_CHAIN_ID: "internal-devnet-6be.86067e06a5"
REACT_APP_NAMADA_URL: "https://proxy.heliax.click/internal-devnet-6be.86067e06a5"
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v1.2.3
with:
publish-dir: "./apps/namada-interface/build"
production-branch: main
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Merged PR ${{ github.event.number }} to main"
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_ACCESS_TOKEN_WALLET_PREVIEW }}
NETLIFY_SITE_ID: 2380782e-9b20-477a-bc27-b4e9d05e16f3
- name: Slack Notification
run: |
curl --header "Content-Type: application/json" \
--request POST \
--data '{"message":"https://wallet-preview-heliax-dev.netlify.app"}' \
${{ secrets.SLACK_WEBHOOK_WALLET_RELEASE }}