Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b660dc4613 | ||
|
|
8a6aacc70d |
@@ -1,4 +1,4 @@
|
||||
name: Publish Docker image
|
||||
name: Publish Docker image to Gitea
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -8,11 +8,12 @@ on:
|
||||
|
||||
jobs:
|
||||
build-docker:
|
||||
name: Push Docker image to multiple registries
|
||||
name: Build and push to Gitea Registry
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
packages: write
|
||||
packages: write # 必须:允许写入软件包
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v4
|
||||
@@ -23,18 +24,23 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to the Container registry
|
||||
- name: Log in to Gitea Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
# 修改点1: 这里填你的 Gitea 域名
|
||||
registry: git.chgr.cc
|
||||
# 修改点2: 使用触发 Action 的 Gitea 用户名
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GGITHUB_TOKEN }}
|
||||
# 修改点3: 直接使用 Gitea 内置的 Token,无需额外配置 Secret!
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository }}
|
||||
# 修改点4: 这里的格式是 "域名/用户名/仓库名"
|
||||
# 注意:Gitea 镜像名通常要求全小写
|
||||
images: git.chgr.cc/${{ github.repository }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
@@ -46,4 +52,4 @@ jobs:
|
||||
linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
@@ -2,7 +2,6 @@ name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branch: main
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
@@ -14,12 +13,28 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-depth: 0 # 必须抓取完整历史才能生成日志
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: lts/*
|
||||
|
||||
- run: npx changelogithub
|
||||
# 步骤 1: 本地生成 Changelog (不依赖 GitHub API)
|
||||
- name: Generate Changelog
|
||||
run: |
|
||||
npx conventional-changelog-cli -p angular -i CHANGELOG.md -s
|
||||
# 说明: 这会根据你的 commit 记录生成 CHANGELOG.md 文件
|
||||
|
||||
# 步骤 2: 发布 Release 到 Gitea
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
body_path: CHANGELOG.md # 把生成的内容作为 Release 的描述
|
||||
files: | # 如果你有构建产物想上传,写在这里
|
||||
# dist/app.js
|
||||
# build/*.zip
|
||||
env:
|
||||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# 关键: 如果 softprops 无法自动识别 Gitea,有时需要指定 URL,
|
||||
# 但通常 Gitea Runner 会自动注入 GITHUB_API_URL 环境变量,
|
||||
# 所以大多数情况下直接用即可。
|
||||
Reference in New Issue
Block a user