Merge pull request #57 from kiosion/dependabot/hex/mox-1.2.0 #90
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
name: CI | |
on: | |
push: | |
branches: [ "main" ] | |
paths-ignore: | |
- '**/*.md' | |
- 'Makefile' | |
- '.gitignore' | |
concurrency: | |
group: ci | |
cancel-in-progress: true | |
jobs: | |
test: | |
name: Tests | |
uses: ./.github/workflows/test.yml | |
build: | |
name: Build & Push Image | |
runs-on: ubuntu-latest | |
needs: [ test ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GCP Artifact Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: us-central1-docker.pkg.dev | |
username: _json_key | |
password: ${{ secrets.GCP_AR_KEY }} | |
- name: Build & Push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: true | |
tags: | | |
us-central1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/docker/toru-prod:${{ github.sha }} | |
us-central1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/docker/toru-prod:latest | |
build-args: | | |
LFM_TOKEN=${{ secrets.LFM_TOKEN }} | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
steps: | |
- name: Deploy to VPS | |
uses: appleboy/ssh-action@2344d975738ad85c2c0bc848a78cef0d4ce17ec0 | |
with: | |
host: ${{ vars.SSH_HOST }} | |
username: ${{ vars.SSH_USER }} | |
key: ${{ secrets.SSH_KEY }} | |
script: | | |
docker pull us-central1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/docker/toru-prod:latest | |
docker stop toru-prod || true | |
docker rm toru-prod || true | |
docker run -d --rm --name toru-prod -p 8080:8080 -e PORT=8080 us-central1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/docker/toru-prod:latest |