From 830f4baea319a1eda0ac7eece0a61f661ed8c951 Mon Sep 17 00:00:00 2001 From: Sigri Date: Mon, 29 Jan 2024 23:32:44 +0100 Subject: [PATCH] Clean code --- .github/workflows/preprod.yml | 84 +++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 38 deletions(-) diff --git a/.github/workflows/preprod.yml b/.github/workflows/preprod.yml index ec4422f..8810df4 100644 --- a/.github/workflows/preprod.yml +++ b/.github/workflows/preprod.yml @@ -1,11 +1,12 @@ -name: To registry, pull and up +name: Deploy server over CI/CD on: - workflow_dispatch: - pull_request: - push: - branches: - - preprod + push: + branches: [ "preprod" ] + pull_request: + branches: [ "preprod" ] +permissions: + contents: read jobs: build: @@ -19,37 +20,44 @@ jobs: API: ${{ secrets.API_KEY }} run: sed -i -e "s/secret.API_KEY/$API/" assets/js/main.js - - name: Build and push Docker image - uses: docker/build-push-action@v4 - with: - context: . - push: true - tags: registry.realt.community/stats-realt:${{ github.ref_name }} + - name: Login to registry + uses: docker/login-action@v2 + with: + registry: ${{ secrets.DOCKER_REGISTRY }} + username: ${{ secrets.DOCKER_LOGIN }} + password: ${{ secrets.DOCKER_PASSWD }} + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: ${{ secrets.DOCKER_REGISTRY }}/stats-realt:${{ github.ref_name }} - - name: Configure SSH - run: | - mkdir -p ~/.ssh/ - echo "$SSH_KEY" > ~/.ssh/staging.key - chmod 600 ~/.ssh/staging.key - cat >>~/.ssh/config < ~/.ssh/staging.key + chmod 600 ~/.ssh/staging.key + cat >>~/.ssh/config <