Merge pull request #152 from SeaweedbrainCY/dependabot/pip/api/python… #206
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: "zero-totp.com deployment" | |
on: | |
push: | |
branches: | |
- dev | |
jobs: | |
tests: | |
uses: ./.github/workflows/test.yml | |
secrets: | |
GITGUARDIAN_API_KEY: ${{ secrets.GITGUARDIAN_API_KEY }} | |
docker-frontend: | |
needs: [tests] | |
name: Publish Frontend Docker image | |
runs-on: ubuntu-latest | |
env: | |
REPO: ${{secrets.DOCKER_DEV_REPO}} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Login to Github | |
run : echo ${{ secrets.TOKEN_GITHUB }} | docker login ghcr.io -u ${{ secrets.USERNAME_GITHUB }} --password-stdin | |
- name: Create environment file | |
working-directory: ./frontend | |
run: bash generate-env.sh 'dev' '${{secrets.DEV_RSA_PUBLIC_KEY}}' | |
- name: Generate sitemap.xml | |
working-directory: ./frontend | |
run: bash generate_sitemap.sh | |
- name: Build Docker image | |
working-directory: ./frontend | |
run: current_version=$(echo ${{ github.ref_name }} | sed 's/\([0-9]*\.[0-9]*\).*$/\1/') && docker build -t ghcr.io/${{ secrets.USERNAME_GITHUB }}/$REPO/frontend:latest . | |
- name: Publish Docker Image | |
run: docker push ghcr.io/${{ secrets.USERNAME_GITHUB }}/$REPO/frontend:latest | |
docker-api: | |
needs: [tests] | |
name: Publish API-dev Docker image | |
runs-on: ubuntu-latest | |
env: | |
REPO: ${{secrets.DOCKER_DEV_REPO}} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Login to Github | |
run : echo ${{ secrets.TOKEN_GITHUB }} | docker login ghcr.io -u ${{ secrets.USERNAME_GITHUB }} --password-stdin | |
- name: Build Docker image | |
working-directory: ./api | |
run: current_version=$(echo ${{ github.ref_name }} | sed 's/\([0-9]*\.[0-9]*\).*$/\1/') && docker build -t ghcr.io/${{ secrets.USERNAME_GITHUB }}/$REPO/api:latest . | |
- name: Publish Docker Image | |
run: docker push ghcr.io/${{ secrets.USERNAME_GITHUB }}/$REPO/api:latest | |
deploy-dev-env: | |
needs: [docker-frontend, docker-api] | |
name: Deploy on development environment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Dev env deployment | |
uses: distributhor/workflow-webhook@v3 | |
env: | |
webhook_url: ${{ secrets.WEBHOOK_URL_DEV }} | |