2022-12-05 20:39:09 +01:00
|
|
|
name: Deploy app
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2022-12-05 20:39:53 +01:00
|
|
|
- main
|
2022-12-05 20:39:09 +01:00
|
|
|
jobs:
|
|
|
|
api-deploy:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-12-05 20:46:07 +01:00
|
|
|
- uses: actions/checkout@v3
|
2022-12-05 20:42:14 +01:00
|
|
|
with:
|
|
|
|
submodules: "true"
|
2022-12-05 20:56:10 +01:00
|
|
|
ssh-key: |
|
2022-12-05 20:54:47 +01:00
|
|
|
${{ secrets.SSH_PRIVATE_KEY}}
|
2022-12-05 20:39:09 +01:00
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Login to DockerHub
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
|
|
|
registry: container-registry.nocodelytics.com
|
|
|
|
username: nocodelytics
|
|
|
|
password: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
|
|
|
|
- name: Build and push
|
|
|
|
uses: docker/build-push-action@v3
|
|
|
|
with:
|
2022-12-05 20:57:50 +01:00
|
|
|
context: .
|
2022-12-05 20:59:50 +01:00
|
|
|
file: ./Dockerfile
|
2022-12-05 20:39:09 +01:00
|
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
push: true
|
|
|
|
tags: |
|
2022-12-05 22:54:45 +01:00
|
|
|
container-registry.nocodelytics.com/nocodelytics/tracker-api:latest
|
|
|
|
container-registry.nocodelytics.com/nocodelytics/tracker-api:${{ github.sha }}
|
2022-12-05 20:39:09 +01:00
|
|
|
|
|
|
|
# # Migrate database
|
|
|
|
# - name: migrate db
|
|
|
|
# run: docker run -v $(pwd)/api/migrations:/migrations --network host migrate/migrate -source file://migrations -database "${{ secrets.DATABASE_URL }}" up
|
|
|
|
|
|
|
|
# # deploy
|
|
|
|
# - name: Restore infra cache
|
|
|
|
# uses: actions/cache@v2
|
|
|
|
# with:
|
|
|
|
# path: infra/node_modules
|
|
|
|
# key: ${{ runner.OS }}-npm-cache-${{ hashFiles('infra/package-lock.json') }}
|
|
|
|
# - uses: actions/setup-node@v2
|
|
|
|
# with:
|
|
|
|
# node-version: "16.0"
|
|
|
|
# - name: npm install
|
|
|
|
# run: npm --prefix=infra install
|
|
|
|
# # - name: Setup upterm session
|
|
|
|
# # uses: lhotari/action-upterm@v1
|
|
|
|
# # Deploy on Kubernetes
|
|
|
|
# - name: Deploy
|
|
|
|
# run: npm --prefix=infra run updateVersion -- --namespace=stage --tag=$DOCKER_TAG
|