This commit is contained in:
34
.gitea/workflows/docker.yml
Normal file
34
.gitea/workflows/docker.yml
Normal file
@@ -0,0 +1,34 @@
|
||||
name: Build to Gitea Registry
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# 登录到 Gitea 内置仓库
|
||||
- name: Login to Gitea Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ vars.REGISTRY_ADDR }} # 要上传的仓库地址: gitea.guetsec.cn
|
||||
username: ${{ secrets.REGISTRY_USERNAME }} # Gitea 用户名
|
||||
password: ${{ secrets.REGISTRY_TOKEN }} # Gitea 有package读写权限的访问令牌
|
||||
|
||||
# 设置动态标签
|
||||
- name: Set image tags
|
||||
id: tags
|
||||
run: |
|
||||
SHORT_SHA=$(echo ${GITEA_SHA} | cut -c1-8)
|
||||
echo "tags=${{ vars.REGISTRY_ADDR }}/${{ gitea.repository }}:${SHORT_SHA}" >> $GITHUB_OUTPUT
|
||||
echo "tags=${{ vars.REGISTRY_ADDR }}/${{ gitea.repository }}:latest" >> $GITHUB_OUTPUT
|
||||
|
||||
# 构建并推送
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.tags.outputs.tags }}
|
||||
Reference in New Issue
Block a user