ci: add release ci

This commit is contained in:
ReaJason
2025-02-03 00:26:35 +08:00
parent 067dae90ff
commit cd870594b0
3 changed files with 79 additions and 7 deletions
@@ -1,12 +1,39 @@
name: Build
name: Release
on:
workflow_dispatch:
push:
tags:
- 'v*'
jobs:
info:
name: Parse release info
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
version-without-v: ${{ steps.get_version.outputs.version-without-v }}
changelog: ${{ steps.get_changelog.outputs.changelog }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Get Version
id: get_version
uses: battila7/get-version-action@v2
- name: Get ChangeLog
id: get_changelog
working-directory: scripts
run:
changelog=$(python parse_changelog_of_version.py "${{ steps.get_version.outputs.version }}")
echo "changelog=${changelog}" >> $GITHUB_OUTPUT
build-jar:
name: Build Jar
runs-on: ubuntu-latest
needs: [ info ]
steps:
- uses: actions/checkout@v4
@@ -30,16 +57,17 @@ jobs:
bun-version: latest
- name: Build Web with Bun
run: cd web && bun install --frozen-lockfile && bun run build
working-directory: web
run: bun install --frozen-lockfile && bun run build
- name: Build Boot with Gradle
run: ./gradlew :boot:bootjar -x test
run: ./gradlew -Pversion=${{ needs.info.outputs.version-without-v }} :boot:bootjar -x test
- name: Upload Boot Jar
uses: actions/upload-artifact@v4
with:
name: boot
path: boot/build/libs/boot.jar
path: boot/build/libs/boot-${{ needs.info.outputs.version-without-v }}.jar
docker-push:
name: Docker Push
@@ -79,9 +107,29 @@ jobs:
context: boot
platforms: linux/amd64,linux/arm64
push: true
build-args: |
VERSION=${{ needs.info.outputs.version-without-v }}
tags: |
docker.io/reajason/memshell-party:latest
docker.io/reajason/memshell-party:${{ needs.info.outputs.version-without-v }}
ghcr.io/reajason/memshell-party:latest
ghcr.io/reajason/memshell-party:${{ needs.info.outputs.version-without-v }}
create-release:
name: Create Release
needs: [ docker-push ]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Release
uses: ncipollo/release-action@v1
with:
name: ${{ needs.info.outputs.version }}
tag: ${{ needs.info.outputs.version }}
body: ${{ needs.info.outputs.changelog }}
deploy-northflank:
name: Deploy to Northflank
+2 -2
View File
@@ -4,8 +4,8 @@
<p>一键生成常见中间件框架内存马,让内存马测试变得简单高效,打造内存马的全方位学习平台</p>
<p>在遍地是轮子的时代,是时候造车,带着大伙加速冲冲冲了</p>
[![test](https://img.shields.io/github/actions/workflow/status/reajason/memshellparty/test.yaml?label=Test&branch=master&style=flat-square&color=blueviolet)](https://github.com/ReaJason/MemShellParty/actions)
[![build](https://img.shields.io/github/actions/workflow/status/reajason/memshellparty/build.yaml?label=Build&branch=master&style=flat-square&color=blueviolet)](https://github.com/ReaJason/MemShellParty/actions)
[![test](https://img.shields.io/github/actions/workflow/status/reajason/memshellparty/test.yaml?label=Test&branch=master&style=flat-square&color=blueviolet)](https://github.com/ReaJason/MemShellParty/actions/workflows/test.yaml)
[![release](https://img.shields.io/github/actions/workflow/status/reajason/memshellparty/release.yaml?label=Release&branch=master&style=flat-square&color=blueviolet)](https://github.com/ReaJason/MemShellParty/actions/workflows/release.yaml)
[![license](https://img.shields.io/github/license/reajason/memshellparty?style=flat-square&label=License&color=blueviolet)](https://github.com/ReaJason/MemShellParty?tab=MIT-1-ov-file)
[![Telegram](https://img.shields.io/badge/Telegram-2CA5E0?style=flat-square&logo=telegram&logoColor=white)](https://t.me/memshell)
+24
View File
@@ -0,0 +1,24 @@
import argparse
import sys
if __name__ == '__main__':
capture = False
result_lines = []
parser = argparse.ArgumentParser(description="Extract changelog for a specific version")
parser.add_argument("version", help="The version of the changelog to extract, e.g. 'v1.0.0'")
args = parser.parse_args()
version = args.version
with open("../CHANGELOG.md") as f:
lines = f.readlines()
for line in lines:
if line.startswith(f"## [{version}]"):
capture = True
elif capture and line.startswith("## ["):
break
elif capture:
result_lines.append(line)
if not result_lines:
print("Specified version not found.", file=sys.stderr)
sys.exit(1)
print("".join(result_lines).strip())