ActionDemo/.gitea/workflows/AutoRelease.yaml
iorebuild ddc9c8ab51
Some checks failed
自动版本发布 / AutoRelease (push) Failing after 4s
Release v1.0.5
2025-04-10 20:41:49 +08:00

77 lines
3.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: 自动版本发布
on:
push:
branches:
- main
jobs:
AutoRelease:
# 如果有Release标签则运行jobs
if: "contains(github.event.head_commit.message, 'Release')"
# 工作在ubuntu-latest系统中
runs-on: ubuntu-latest
# 以下是steps
steps:
- name: 设置环境变量
env:
GITEA_TOKEN: ${{ secrets.AUTOGENERATE }}
GITEA_REPO_URL: ${{ github.server_url }}/${{ github.repository }}
REPO_NAME: ${{ github.event.repository.name }}
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.git.linuxacme.com"
# 检出仓库
- name: Checkout
uses: https://gitee.com/actions-mirror/checkout@v4
with:
fetch-depth: 0
# 启用子模块支持
submodules: true
- name: 替换软件源为国内软件源USTC
run: |
cat /etc/os-release
sudo rm -f /etc/apt/sources.list
sudo rm -f /etc/apt/sources.list.d/*
sudo tee /etc/apt/sources.list <<EOF
deb http://mirrors.ustc.edu.cn/ubuntu/ noble main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ noble main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ noble-security main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ noble-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ noble-updates main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ noble-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ noble-backports main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ noble-backports main restricted universe multiverse
EOF
- name: 安装 tea 工具
run: |
# 更新 apt 缓存
sudo apt-get update
# 安装 tea 工具
sudo apt-get install -y tea golang
- name: 生成版本号
id: generate_version
run: |
VERSION=$(echo "${{ github.event.head_commit.message }}" | grep -oP 'Release v\K[0-9.]+')
echo "::set-output name=version::$VERSION"
- name: 创建标签
run: |
# git tag -d v${{ steps.generate_version.outputs.version }}
# git push origin --delete v${{ steps.generate_version.outputs.version }}
git tag -a v${{ steps.generate_version.outputs.version }} -m "Release v${{ steps.generate_version.outputs.version }}"
git push origin v${{ steps.generate_version.outputs.version }}
- name: 创建发布
uses: https://gitea.com/actions/release-action@main
with:
tag_name: v${{ steps.generate_version.outputs.version }}
release_name: Release v${{ steps.generate_version.outputs.version }}
body: |
这是版本 v${{ steps.generate_version.outputs.version }} 的发布说明。
你可以在这里详细描述这个版本的变更内容。