-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into chore/migrate-client-to-vite
- Loading branch information
Showing
3 changed files
with
78 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Deploy Workflow | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
deployment: | ||
type: boolean | ||
description: 'Deploy after build?' | ||
required: false | ||
default: false | ||
environment: | ||
type: choice | ||
description: 'Select the environment to deploy to' | ||
options: | ||
- staging | ||
- prod | ||
- shimmer-staging | ||
- shimmer-prod | ||
required: false | ||
default: staging | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.IOTALEDGER_DOCKER_USERNAME }} | ||
password: ${{ secrets.IOTALEDGER_DOCKER_PASSWORD }} | ||
|
||
#- name: Get the version | ||
# id: get_version | ||
# run: echo "VERSION=$(git describe --tags)" >> $GITHUB_ENV | ||
|
||
- name: Get the short commit hash | ||
run: | | ||
COMMIT_HASH=$(git rev-parse --short HEAD) | ||
echo "VERSION=$COMMIT_HASH" >> $GITHUB_ENV | ||
- name: Set up Environment Variable | ||
run: echo "DEPLOY_ENV=${{ github.event.inputs.environment }}" >> $GITHUB_ENV | ||
|
||
- name: Build and push API Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./api | ||
file: ./api/Dockerfile | ||
push: true | ||
tags: iotaledger/explorer-api:${{ env.VERSION }} | ||
no-cache: true | ||
|
||
- name: Build and push Client Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./client | ||
file: ./client/Dockerfile | ||
push: true | ||
tags: iotaledger/explorer-client:${{ env.VERSION }} | ||
no-cache: true | ||
|
||
- name: Add SSH key | ||
uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.UPDATER_SSH_PRIVATE_KEY }} | ||
|
||
- name: Deploy to Server | ||
if: ${{ github.event.inputs.deployment }} | ||
run: | | ||
ssh -o StrictHostKeyChecking=no updater@${{ secrets.EXPLORER_GATEWAY }} "${{ env.DEPLOY_ENV }} ${{ env.VERSION }}" |
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
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