ActionDemo/.gitea/workflows/AutoRelease.yaml
iorebuild a3a9a1bd99
All checks were successful
自动版本发布 / AutoRelease (push) Successful in 1m7s
Release v1.0.5
2025-04-10 20:34:39 +08:00

89 lines
3.6 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: 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: 删除本地仓库副本
env:
REPO_NAME: ${{ github.event.repository.name }}
run: |
if [ -d "$REPO_NAME" ]; then
rm -rf "$REPO_NAME"
fi
# - name: 检出仓库
# env:
# GITEA_TOKEN: ${{ secrets.AUTOGENERATE }}
# GITEA_REPO_URL: ${{ github.server_url }}/${{ github.repository }}
# CLEAN_REPO_URL: ${{ github.server_url }}/${{ github.repository }}
# run: |
# # CLEAN_REPO_URL="${CLEAN_REPO_URL#https://}"
# # git clone "https://${GITEA_TOKEN}@${CLEAN_REPO_URL}" .
# - name: 设置 Git 身份
# run: |
# git config user.name "${{ github.actor }}"
# git config user.email "${{ github.actor }}@users.noreply.git.linuxacme.com"
# - 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 }} 的发布说明。
# 你可以在这里详细描述这个版本的变更内容。