Skip to content

Commit

Permalink
create GH action for wiab deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
amitsagtani97 committed Oct 25, 2024
1 parent 0ea5c23 commit 544ab08
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/custom-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
workflow_dispatch:
jobs:
offline:
name: Prepare custom offline package
name: Prepare custom offline package # Do not change this name, it is used to trigger deploy-wiab workflow
# Useful to skip expensive CI when writing docs
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on:
Expand Down Expand Up @@ -54,6 +54,11 @@ jobs:
env:
DOCKER_LOGIN: '${{ secrets.DOCKER_LOGIN }}'

# Set output for deploy-wiab workflow to start
- name: Set output to trigger dependent workflow
if: success()
run: echo "::set-output name=trigger_next_workflow::true"

- name: Deploy offline environment to hetzner
run: |
./offline/cd.sh
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/deploy-wiab.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Deploy on Hetnzer WIAB setup
on:
workflow_run:
workflows: ["Prepare custom offline package"]
types:
- completed

jobs:
deploy:
runs-on: ubuntu-latest
concurrency:
group: autodeploy-script
cancel-in-progress: false

steps:
# Step 1: Checkout the repository code
- name: Checkout code
uses: actions/checkout@v3

# Step 2: Set up SSH key for remote access
- name: Set up SSH key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

# Step 3: Get the latest commit SHA, for the artifact
- name: Get latest commit SHA
id: get_commit_sha
run: |
COMMIT_SHA=$(git rev-parse --short HEAD)
echo "commit_sha=$COMMIT_SHA" >> $GITHUB_ENV
# Step 4: Run the autodeploy script
- name: Run Auto Deploy Script
run: |
cd bin
./autodeploy.sh --artifact-hash ${{ env.commit_sha }} --target-domain wiab-test-box.wire.link

0 comments on commit 544ab08

Please sign in to comment.