This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
name: Build and publish Docker image
|
||||
name: Build and publish Docker images
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -10,6 +10,9 @@ jobs:
|
||||
publish:
|
||||
name: Test, build and publish
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
releases: write
|
||||
|
||||
steps:
|
||||
- name: Check out repository
|
||||
@@ -39,11 +42,20 @@ jobs:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Log in to Gitea Container Registry
|
||||
uses: https://github.com/docker/login-action@v3
|
||||
with:
|
||||
registry: git.biss.click
|
||||
username: ${{ vars.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Generate image tags and labels
|
||||
id: metadata
|
||||
uses: https://github.com/docker/metadata-action@v5
|
||||
with:
|
||||
images: docker.io/${{ vars.DOCKERHUB_IMAGE }}
|
||||
images: |
|
||||
docker.io/${{ vars.DOCKERHUB_IMAGE }}
|
||||
git.biss.click/biss/exam-information-system
|
||||
flavor: latest=false
|
||||
tags: |
|
||||
type=raw,value=latest,enable=${{ gitea.ref == 'refs/heads/master' }}
|
||||
@@ -62,3 +74,18 @@ jobs:
|
||||
labels: ${{ steps.metadata.outputs.labels }}
|
||||
cache-from: type=registry,ref=docker.io/${{ vars.DOCKERHUB_IMAGE }}:buildcache
|
||||
cache-to: type=registry,ref=docker.io/${{ vars.DOCKERHUB_IMAGE }}:buildcache,mode=max
|
||||
|
||||
- name: Create Gitea release
|
||||
if: gitea.ref_type == 'tag'
|
||||
uses: https://gitea.com/actions/gitea-release-action@v1
|
||||
with:
|
||||
token: ${{ secrets.GITEA_TOKEN }}
|
||||
tag_name: ${{ gitea.ref_name }}
|
||||
name: ${{ gitea.ref_name }}
|
||||
body: |
|
||||
Docker 镜像已发布:
|
||||
|
||||
```text
|
||||
docker pull docker.io/${{ vars.DOCKERHUB_IMAGE }}:${{ steps.metadata.outputs.version }}
|
||||
docker pull git.biss.click/biss/exam-information-system:${{ steps.metadata.outputs.version }}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user