Skip to content

Fix random verified quiz errors (#126) #473

Fix random verified quiz errors (#126)

Fix random verified quiz errors (#126) #473

Workflow file for this run

name: 'deploy'
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
concurrency:
group: build-or-deploy
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: jwalton/gh-find-current-pr@v1
id: findPr
with:
state: all
- name: Add tag to env
run: echo "TAG=pr-${{ steps.findPr.outputs.pr }}" >> $GITHUB_ENV
- name: Check if tag exists
id: check-tag
continue-on-error: true
run: |
docker manifest inspect camer0/nico:${{ env.TAG }} > /dev/null
- name: Build and push image
if: steps.check-tag.outcome == 'failure'
uses: docker/build-push-action@v5
with:
push: true
tags: camer0/nico:${{ env.TAG }}
context: .
build-args: |
CRYPT64=${{ secrets.CRYPT64 }}
cache-from: type=registry,ref=camer0/nico:buildcache
cache-to: type=registry,ref=camer0/nico:buildcache,mode=min
file: .docker/image.dockerfile
- name: Rename tag to :latest in Docker Hub
run: |
docker buildx imagetools create camer0/nico:${{ env.TAG }} --tag camer0/nico:latest
- name: Push to Dokku
uses: dokku/github-action@master
with:
git_remote_url: ${{ secrets.DOKKU_SSH_URL }}
ssh_private_key: ${{ secrets.DOKKU_SSH_PK }}
git_push_flags: '--force'
- name: Remove PR tag from Docker Hub
run: |
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d \
'{"username": "${{ secrets.DOCKERHUB_USERNAME }}", "password": "${{ secrets.DOCKERHUB_PASSWORD }}"}' \
https://hub.docker.com/v2/users/login/ | jq -r .token)
echo "::add-mask::$TOKEN"
curl -i -X DELETE \
-H "Accept: application/json" \
-H "Authorization: JWT $TOKEN" \
https://hub.docker.com/v2/repositories/camer0/nico/tags/${{ env.TAG }}/