mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-21 21:47:17 +00:00
129 lines
4.2 KiB
YAML
129 lines
4.2 KiB
YAML
name: Test system deploy
|
|
|
|
on:
|
|
pull_request_target:
|
|
types: [labeled, unlabeled, closed]
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
env:
|
|
PR_NUMBER: ${{ github.event.number }}
|
|
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
|
|
|
jobs:
|
|
Build-and-update-image:
|
|
runs-on: ubuntu-22.04
|
|
|
|
if: ${{ github.event.action == 'labeled' && github.event.label.name == 'test-system-deploy' }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.ref }}
|
|
|
|
# Create Docker Buildx builder with platform configuration
|
|
# - name: Set up Docker Buildx
|
|
# run: |
|
|
# mkdir -p ~/.docker/cli-plugins
|
|
# curl -SL https://github.com/docker/buildx/releases/download/v0.11.0/buildx-v0.11.0.linux-amd64 -o ~/.docker/cli-plugins/docker-buildx
|
|
# chmod a+x ~/.docker/cli-plugins/docker-buildx
|
|
# docker buildx create --name mybuilder --platform linux/arm64,linux/amd64,linux/amd64/v2,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6
|
|
# docker buildx use mybuilder
|
|
|
|
# - name: Set DOCKER_CLI_EXPERIMENTAL
|
|
# run: echo "DOCKER_CLI_EXPERIMENTAL=enabled" >> $GITHUB_ENV
|
|
|
|
# - name: use mybuilder buildx
|
|
# run: docker buildx use mybuilder
|
|
|
|
# - name: Docker Login
|
|
# uses: docker/login-action@v2
|
|
# with:
|
|
# username: ${{ secrets.DOCKER_USERNAME }}
|
|
# password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
# - name: Set SAFE_BRANCH_NAME
|
|
# run: echo "SAFE_BRANCH_NAME=$(echo ${{ env.BRANCH_NAME }} | tr '/' '-')" >> $GITHUB_ENV
|
|
|
|
# - name: Build and Push Docker image
|
|
# uses: docker/build-push-action@v4
|
|
# with:
|
|
# context: .
|
|
# file: docker/production.Dockerfile
|
|
# push: true
|
|
# tags: tooljet/tj-osv:${{ env.SAFE_BRANCH_NAME }}
|
|
# platforms: linux/amd64
|
|
# env:
|
|
# DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
|
# DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Authenticate GCP profile
|
|
uses: 'google-github-actions/auth@v2'
|
|
with:
|
|
credentials_json: '${{ secrets.GCP_SA_KEY }}'
|
|
|
|
- name: Connect to GCP
|
|
uses: google-github-actions/setup-gcloud@v2
|
|
with:
|
|
project_id: tooljet-us
|
|
version: '>= 363.0.0'
|
|
|
|
- name: Install Google Cloud SDK
|
|
run: |
|
|
gcloud components install gke-gcloud-auth-plugin
|
|
gcloud init
|
|
|
|
# - name: Connect to VM using GCP command
|
|
# run: |
|
|
# gcloud compute --project "tooljet-us" ssh --zone "us-central1-a" "adish@ce-test-system" --ssh-key-file ~/.ssh/gcp_compute_engine
|
|
|
|
- name: SSH into GCP VM instance
|
|
uses: appleboy/ssh-action@master
|
|
with:
|
|
host: 35.209.30.169
|
|
username: adish
|
|
key: ${{ secrets.EC2_INSTANCE_SSH_KEY }}
|
|
script: |
|
|
ls -lah
|
|
|
|
# # Stop the Docker containers
|
|
# sudo docker-compose down
|
|
|
|
# # Remove the existing tooljet/* images
|
|
# sudo docker images -a | grep 'tooljet/' | awk '{print $3}' | xargs sudo docker rmi -f
|
|
|
|
# #checking images
|
|
# sudo docker images
|
|
|
|
# # Update docker-compose.yml with the new image
|
|
# sed -i '/^[[:space:]]*tooljet:/,/^$/ s|^\([[:space:]]*image:[[:space:]]*\).*|\1tooljet/tj-osv:${{ env.SAFE_BRANCH_NAME }}|' docker-compose.yaml
|
|
|
|
# # Start the Docker containers
|
|
# cat docker-compose.yaml
|
|
# sudo docker-compose up -d
|
|
|
|
#View containers
|
|
sudo docker ps
|
|
|
|
- uses: actions/github-script@v6
|
|
with:
|
|
script: |
|
|
try {
|
|
await github.rest.issues.removeLabel({
|
|
issue_number: context.issue.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
name: 'test-system-deploy'
|
|
})
|
|
} catch (e) {
|
|
console.log(e)
|
|
}
|
|
|
|
await github.rest.issues.addLabels({
|
|
issue_number: context.issue.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
labels: ['test-system-deployed']
|
|
})
|