Skip to content

Merge pull request #215 from Enraged-Dun-Cookie-Development-Team/feat… #149

Merge pull request #215 from Enraged-Dun-Cookie-Development-Team/feat…

Merge pull request #215 from Enraged-Dun-Cookie-Development-Team/feat… #149

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Docker build CI
on:
# for debug
# pull_request:
push:
branches: [ master ]
tags:
- "v*"
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
-
name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
run: |
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
-
name: Build and push release
uses: docker/build-push-action@v4
if: startsWith(github.ref, 'refs/tags/v')
with:
context: .
push: true
tags: ceobecanteen/ceobe-canteen-server:${{ env.TAG_NAME }}
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
sbom: false
-
name: Build and push latest
uses: docker/build-push-action@v4
if: "!startsWith(github.ref, 'refs/tags/v') && github.event_name == 'push'"
with:
context: .
push: true
tags: ceobecanteen/ceobe-canteen-server
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
sbom: false
-
name: Build and push debug
uses: docker/build-push-action@v4
if: "github.event_name == 'pull_request'"
with:
context: .
push: true
tags: ceobecanteen/ceobe-canteen-server:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
sbom: false