Skip to content

Commit

Permalink
try to simulate the release process
Browse files Browse the repository at this point in the history
  • Loading branch information
yourmoonlight committed Jun 4, 2024
1 parent fae1c17 commit 5a75a73
Showing 1 changed file with 30 additions and 15 deletions.
45 changes: 30 additions & 15 deletions .github/workflows/deploy_testnet.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
name: Deploy TESTNET Seed

on:
# release:
# types: [released, prereleased]
release:
types: [published, prereleased, released]
workflow_dispatch:
inputs:
ref:
description: 'Tag or branch to deploy'
default: 'main'
workflow_run:
workflows: ["Build Docker And Deploy Seed"]
types:
- completed
required: true
default: 'refs/tags/v0.0.0'
event_name:
description: 'Event name (use "release" to simulate release event)'
required: true
default: 'workflow_dispatch'
action:
description: 'Action name (e.g., "published", "prereleased", "released")'
required: false
default: ''

jobs:
deploy-rooch-testnet:
name: Deploy Rooch Testnet
runs-on: self-hosted
# if: |
# github.event_name == 'workflow_dispatch' ||
# (github.event.workflow_run.conclusion == 'success' &&
# github.event.workflow_run.event == 'release' &&
# (github.event.release.prerelease == true || github.event.release.prerelease == false))
if: |
github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success'
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'prereleased' || github.event.action == 'released')) ||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand All @@ -32,18 +35,30 @@ jobs:
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "REF=${{ github.event.inputs.ref }}" >> $GITHUB_ENV
echo "EVENT_NAME=${{ github.event.inputs.event_name }}" >> $GITHUB_ENV
echo "ACTION=${{ github.event.inputs.action }}" >> $GITHUB_ENV
else
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
REF=${GITHUB_REF#refs/tags/}
elif [[ "${{ github.ref }}" == refs/heads/* ]]; then
REF=${GITHUB_REF#refs/heads/}
fi
echo "REF=$REF" >> $GITHUB_ENV
echo "EVENT_NAME=${{ github.event_name }}" >> $GITHUB_ENV
echo "ACTION=${{ github.event.action }}" >> $GITHUB_ENV
fi
- name: Print ref
run: echo "The ref is ${{ env.REF }}"
- name: Print ref and event info
run: |
echo "The ref is ${{ env.REF }}"
echo "The event name is ${{ env.EVENT_NAME }}"
echo "The action is ${{ env.ACTION }}"
- name: Deploy to GCP TESTNET VM
if: |
env.EVENT_NAME == 'workflow_dispatch' ||
(env.EVENT_NAME == 'release' && (env.ACTION == 'published' || env.ACTION == 'prereleased' || env.ACTION == 'released')) ||
(env.EVENT_NAME == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
env:
PRIVATE_KEY: ${{ secrets.GCP_TEST_WORKFLOW_PK }}
HOST: ${{ secrets.GCP_TEST_WORKFLOW_VM }}
Expand Down

0 comments on commit 5a75a73

Please sign in to comment.