Skip to content

test compute engine ssh 02 #24

test compute engine ssh 02

test compute engine ssh 02 #24

name: CI/CD
on: push
env:
GOOGLE_PROJECT_ID: botchi
# GAR_LOCATION: asia-northeast3-docker.pkg.dev
# REPOSITORY: botchi/botchi-go
# SERVICE: botchi-go
GOOGLE_REGION: asia-northeast3
IMAGE_TAG: ${{ secrets.DOCKERHUB_USERNAME }}/${{ vars.APP_NAME }}:${{ github.ref_type }}-${{ github.ref_name }}
jobs:
cicd:
permissions:
contents: "read"
id-token: "write"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
- name: Google Auth
id: google-auth
uses: "google-github-actions/auth@v1"
with:
token_format: "access_token"
workload_identity_provider: "${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}"
service_account: "${{ secrets.GOOGLE_SERVICE_ACCOUNT }}"
# - name: Login to Docker Hub
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# - name: Build and push
# uses: docker/build-push-action@v5
# with:
# build-args: |
# DISCORD_BOT_TOKEN=${{ secrets.DISCORD_BOT_TOKEN }}
# DISCORD_BOT_LOG_GUILD_ID=${{ vars.DISCORD_BOT_LOG_GUILD_ID }}
# DISCORD_BOT_LOG_CHANNEL_ID=${{ vars.DISCORD_BOT_LOG_CHANNEL_ID }}
# tags: ${{ env.IMAGE_TAG }}
# push: true
- name: Deploy to Compute engine
id: deploy
uses: google-github-actions/ssh-compute@v0
with:
instance_name: container-runner-main
zone: asia-northeast3-a
ssh_private_key: "${{ secrets.GCP_SSH_PRIVATE_KEY }}"
user: ${{ secrets.GCP_SSH_USER }}
command: |
echo $(whoami)
echo $(pwd)
- name: Show Output
run: |-
echo '${{ steps.deploy.outputs.stdout }}'
echo '${{ steps.deploy.outputs.stderr }}'