feat: Logout other sessions #94
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: CI deploy backend to Docker Hub | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push events but only for tags | |
push: | |
branches: [ main ] | |
paths: | |
- backend/** | |
tags: | |
- "v*" | |
- "beta-v*" | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
- name: decide docker tags | |
id: dockertag | |
run: | | |
if [[ $REF == "refs/tags/v"* ]] | |
then | |
echo "tags=$BASE_TAG:latest, $BASE_TAG:beta, $BASE_TAG:${REF#refs/tags/}" >> $GITHUB_ENV | |
elif [[ $REF == "refs/tags/beta-v"* ]] | |
then | |
echo "tags=$BASE_TAG:beta, $BASE_TAG:${REF#refs/tags/}" >> $GITHUB_ENV | |
else | |
echo "tags=$BASE_TAG:dev" >> $GITHUB_ENV | |
fi | |
env: | |
REF: ${{ github.ref }} | |
BASE_TAG: ${{ secrets.DOCKER_HUB_USERNAME }}/kitchenowl-backend | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./backend | |
file: backend/Dockerfile | |
platforms: linux/amd64,linux/arm64 #,linux/arm/v7 #,linux/386,linux/arm/v6 | |
push: true | |
tags: ${{ env.tags }} | |
# cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/kitchenowl:buildcache | |
# cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/kitchenowl:buildcache,mode=max | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} |