Skip to content

Commit

Permalink
pls deploy []
Browse files Browse the repository at this point in the history
  • Loading branch information
bengtlofgren committed Aug 2, 2023
1 parent 44002e4 commit 6e3cec1
Showing 1 changed file with 84 additions and 0 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/deploy-wallet-at-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
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/[email protected]
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/[email protected]
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 }}

0 comments on commit 6e3cec1

Please sign in to comment.