feat: better exception handling in django #802
Workflow file for this run
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: Docker | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: [main] | |
release: | |
types: [published] | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} | |
- name: Get short SHA | |
id: short_sha | |
run: echo "::set-output name=sha::$(git rev-parse --verify HEAD | cut -c 1-7)" | |
- name: Set Node.js environment | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "18" | |
- name: Install dependencies | |
run: | | |
cd frontend | |
yarn install | |
- name: Run Jest Tests | |
run: | | |
cd frontend | |
yarn test | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push frontend | |
id: docker_build_frontend | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./frontend | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/frontend:${{ steps.short_sha.outputs.sha }}, ghcr.io/${{ github.repository }}/frontend:${{ steps.short_sha.outputs.sha }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
- name: Build and push backend | |
id: docker_build_backend | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./backend | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/backend:${{ steps.short_sha.outputs.sha }}, ghcr.io/${{ github.repository }}/backend:${{ steps.short_sha.outputs.sha }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
push: | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set Node.js environment | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "18" | |
- name: Install dependencies | |
run: | | |
cd frontend | |
yarn install | |
- name: Run Jest Tests | |
run: | | |
cd frontend | |
yarn test | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push frontend | |
id: docker_build_frontend_main | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./frontend | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/frontend:latest, ghcr.io/${{ github.repository }}/frontend:latest | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
- name: Build and push backend | |
id: docker_build_backend_main | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./backend | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/backend:latest, ghcr.io/${{ github.repository }}/backend:latest | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
release: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set Node.js environment | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "18" | |
- name: Install dependencies | |
run: | | |
cd frontend | |
yarn install | |
- name: Run Jest Tests | |
run: | | |
cd frontend | |
yarn test | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push frontend | |
id: docker_build_frontend_release | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./frontend | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/frontend:${{ github.event.release.tag_name }}, ghcr.io/${{ github.repository }}/frontend:${{ github.event.release.tag_name }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
- name: Build and push backend | |
id: docker_build_backend_release | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./backend | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/backend:${{ github.event.release.tag_name }}, ghcr.io/${{ github.repository }}/backend:${{ github.event.release.tag_name }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache |