Skip to content

🔧 添加配置样例 #12

🔧 添加配置样例

🔧 添加配置样例 #12

# 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-bot:${{ 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-bot
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-bot:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
sbom: false