mirror of
https://github.com/octopusYan/alist-gui.git
synced 2024-09-20 15:57:25 +08:00
118 lines
3.3 KiB
YAML
118 lines
3.3 KiB
YAML
|
name: Release
|
||
|
|
||
|
on:
|
||
|
push:
|
||
|
tags:
|
||
|
- "v*"
|
||
|
branches: [ "main", "test_ci" ]
|
||
|
paths:
|
||
|
- ".github/workflows/release.yml"
|
||
|
- "src/**"
|
||
|
- "pom.xml"
|
||
|
- "!**/*.md"
|
||
|
|
||
|
jobs:
|
||
|
meta:
|
||
|
runs-on: ubuntu-latest
|
||
|
outputs:
|
||
|
tag: ${{ steps.set_tag.outputs.tag }}
|
||
|
prerelease: ${{ steps.set_pre.outputs.prerelease }}
|
||
|
steps:
|
||
|
- name: Checkout code
|
||
|
uses: actions/checkout@v4
|
||
|
with:
|
||
|
path: temp
|
||
|
show-progress: false
|
||
|
|
||
|
- name: Set tag
|
||
|
id: set_tag
|
||
|
run: |
|
||
|
${{ startsWith(github.ref, 'refs/pull/') && 'cd temp' || '' }}
|
||
|
echo tag=$(git describe --tags --match "v*" ${{ github.ref }} || git rev-parse --short HEAD) | tee -a $GITHUB_OUTPUT
|
||
|
exit ${PIPESTATUS[0]}
|
||
|
|
||
|
- name: Set up Node.js
|
||
|
uses: actions/setup-node@v4
|
||
|
with:
|
||
|
node-version: 14
|
||
|
|
||
|
- name: Install dependencies
|
||
|
run: npm install conventional-changelog-cli
|
||
|
|
||
|
- name: Generate Changelog
|
||
|
run: |
|
||
|
this_tag=${{ steps.set_tag.outputs.tag }}
|
||
|
if [[ '${{ steps.set_pre.outputs.prerelease }}' != 'false' ]]; then
|
||
|
last_tag=$(git describe --tags --match "v*" --abbrev=0 --exclude='${{ steps.set_tag.outputs.tag }}')
|
||
|
else
|
||
|
last_tag=$(git describe --tags --match "v*" --abbrev=0 --exclude='${{ steps.set_tag.outputs.tag }}' --exclude='*-*')
|
||
|
fi
|
||
|
echo >> CHANGELOG.md
|
||
|
npx conventional-changelog -p angular -i CHANGELOG.md -s -r 0
|
||
|
echo "**Full Changelog**: [$last_tag -> $this_tag](https://github.com/octopusYan/alist-gui/compare/${last_tag}...${this_tag})" >> CHANGELOG.md
|
||
|
|
||
|
- name: Upload changelog to Github
|
||
|
uses: actions/upload-artifact@v4
|
||
|
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
||
|
with:
|
||
|
name: changelog
|
||
|
path: CHANGELOG.md
|
||
|
|
||
|
windows:
|
||
|
needs: meta
|
||
|
strategy:
|
||
|
matrix:
|
||
|
include:
|
||
|
- msbuild_target: x64
|
||
|
lowercase_target: x64
|
||
|
runs-on: windows-latest
|
||
|
|
||
|
steps:
|
||
|
- name: Checkout code
|
||
|
uses: actions/checkout@v4
|
||
|
with:
|
||
|
path: temp
|
||
|
show-progress: false
|
||
|
|
||
|
- name: Set up JDK
|
||
|
uses: actions/setup-java@v4
|
||
|
with:
|
||
|
java-version: 21
|
||
|
distribution: 'dragonwell'
|
||
|
architecture: x64
|
||
|
|
||
|
- name: Build with Maven
|
||
|
run: mvn --batch-mode --update-snapshots clean package
|
||
|
|
||
|
- name: Upload AListGUI to Github
|
||
|
uses: actions/upload-artifact@v4
|
||
|
run: mkdir zipball && cp target/*-windows.zip zipball
|
||
|
with:
|
||
|
name: AListGUI-windows
|
||
|
path: zipball
|
||
|
|
||
|
release:
|
||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||
|
needs: [ meta, windows ]
|
||
|
runs-on: ubuntu-latest
|
||
|
steps:
|
||
|
- name: Download AListGUI from Github
|
||
|
uses: actions/download-artifact@v4
|
||
|
with:
|
||
|
path: assets
|
||
|
|
||
|
- name: Cleanup files
|
||
|
run: |
|
||
|
mv -vf assets/changelog/* .
|
||
|
cd assets
|
||
|
find . -type f | while read f; do mv -fvt . $f; done
|
||
|
cd ..
|
||
|
ls .
|
||
|
|
||
|
# - name: Release to Github
|
||
|
# uses: softprops/action-gh-release@v2
|
||
|
# with:
|
||
|
# body_path: CHANGELOG.md
|
||
|
# files: |
|
||
|
# assets/*
|
||
|
# prerelease: ${{ needs.meta.outputs.prerelease != 'false' }}
|