From 3b657439c17069c115312de0b3ea2e704e216447 Mon Sep 17 00:00:00 2001 From: Florian Herrengt Date: Mon, 5 Dec 2022 19:39:09 +0000 Subject: [PATCH] add ci --- .github/workflows/master.yml | 54 ++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/master.yml diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml new file mode 100644 index 0000000..83c5b12 --- /dev/null +++ b/.github/workflows/master.yml @@ -0,0 +1,54 @@ +name: Deploy app +on: + push: + branches: + - master +jobs: + api-build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + api-deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - 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: + platforms: linux/amd64,linux/arm64 + push: true + tags: | + nocodelytics/tracker-api:latest + nocodelytics/tracker-api:${{ github.sha }} + + # # 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