feat: Tron support #12
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: github-pages-cicd | |
on: | |
issue_comment: | |
types: [created] | |
env: | |
SERVER_ENDPOINT: ${{ vars.SERVER_ENDPOINT }} | |
WALLET_CONNECT_PROJECT_ID: ${{ vars.WALLET_CONNECT_PROJECT_ID }} | |
jobs: | |
cicd: | |
if: github.repository == 'bnb-chain/canonical-bridge' && contains(github.event.comment.body, '/qa-deploy:canonical-bridge-ui') | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/github-script@v3 | |
id: get-pr | |
with: | |
script: | | |
const request = { | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: context.issue.number | |
} | |
core.info(`Getting PR #${request.pull_number} from ${request.owner}/${request.repo}`) | |
try { | |
const result = await github.pulls.get(request) | |
return result.data | |
} catch (err) { | |
core.setFailed(`Request failed with error ${err}`) | |
} | |
- name: get pr env | |
id: pr-env | |
run: | | |
GIT_REPOSITORY=${{ fromJSON(steps.get-pr.outputs.result).head.repo.full_name }} | |
PR_NUMBER=${{ fromJSON(steps.get-pr.outputs.result).number }} | |
LATEST_COMMIT_SHA=${{ fromJSON(steps.get-pr.outputs.result).head.sha }} | |
BRANCH_NAME=${{ fromJSON(steps.get-pr.outputs.result).head.ref }} | |
echo "GIT_REPOSITORY=${GIT_REPOSITORY}" >> $GITHUB_OUTPUT | |
echo "PR_NUMBER=${PR_NUMBER}" >> $GITHUB_OUTPUT | |
echo "LATEST_COMMIT_SHA=${LATEST_COMMIT_SHA}" >> $GITHUB_OUTPUT | |
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_OUTPUT | |
- name: Checkout code repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ steps.pr-env.outputs.BRANCH_NAME }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: ./.github/actions/setup | |
- name: Log | |
run: | | |
echo "${{steps.pr-env.outputs.BRANCH_NAME}}" | |
echo "${{steps.pr-env.outputs.GIT_REPOSITORY}}" | |
echo "${{steps.pr-env.outputs.LATEST_COMMIT_SHA}}" | |
echo "${{steps.pr-env.outputs.PR_NUMBER}}" | |
- name: Creating .env | |
shell: bash | |
run: | | |
cat << EOF > "./apps/canonical-bridge-ui/.env" | |
NEXT_PUBLIC_APP_NAME=$APP_NAME | |
NEXT_PUBLIC_BASE_PATH=$BASE_PATH | |
NEXT_PUBLIC_ASSET_PREFIX=$ASSET_PREFIX | |
NEXT_PUBLIC_SERVER_ENDPOINT=$SERVER_ENDPOINT | |
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=$WALLET_CONNECT_PROJECT_ID | |
EOF | |
env: | |
APP_NAME: canonical-bridge | |
BASE_PATH: /canonical-bridge | |
ASSET_PREFIX: /canonical-bridge | |
SERVER_ENDPOINT: ${{ env.SERVER_ENDPOINT }} | |
WALLET_CONNECT_PROJECT_ID: ${{ env.WALLET_CONNECT_PROJECT_ID }} | |
- name: Install & build | |
shell: bash | |
run: | | |
node common/scripts/install-run-rush.js install -t canonical-bridge-ui | |
node common/scripts/install-run-rush.js build -t canonical-bridge-ui | |
# - name: Deploy docs | |
# uses: JamesIves/github-pages-deploy-action@v4 | |
# with: | |
# folder: ./apps/canonical-bridge-ui/dist | |
# branch: 'gh-pages' | |
# clean: true | |
# force: true | |
- name: Pushes to another repository | |
uses: cpina/github-action-push-to-another-repository@main | |
env: | |
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | |
with: | |
source-directory: './apps/canonical-bridge-ui/dist' | |
destination-github-username: 'wenty22' | |
destination-repository-name: 'canonical-bridge' | |
user-email: github-actions[bot]@users.noreply.github.com | |
target-branch: main |