使用矩阵简化更新工作流 (#4725)
This commit is contained in:
78
.github/workflows/check-update.yml
vendored
78
.github/workflows/check-update.yml
vendored
@@ -9,9 +9,19 @@ permissions:
|
|||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
dev-check-update:
|
check-update:
|
||||||
if: ${{ github.repository_owner == 'HMCL-dev' }}
|
if: ${{ github.repository_owner == 'HMCL-dev' }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
max-parallel: 1
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- channel: dev
|
||||||
|
task: checkUpdateDev
|
||||||
|
- channel: stable
|
||||||
|
task: checkUpdateStable
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
name: check-update-${{ matrix.channel }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Set up JDK
|
- name: Set up JDK
|
||||||
@@ -22,7 +32,7 @@ jobs:
|
|||||||
- name: Fetch tags
|
- name: Fetch tags
|
||||||
run: git fetch --all --tags
|
run: git fetch --all --tags
|
||||||
- name: Fetch last version
|
- name: Fetch last version
|
||||||
run: ./gradlew checkUpdateDev --no-daemon --info --stacktrace
|
run: ./gradlew ${{ matrix.task }} --no-daemon --info --stacktrace
|
||||||
- name: Check for existing tags
|
- name: Check for existing tags
|
||||||
run: if [ -z "$(git tag -l "$HMCL_TAG_NAME")" ]; then echo "continue=true" >> $GITHUB_ENV; fi
|
run: if [ -z "$(git tag -l "$HMCL_TAG_NAME")" ]; then echo "continue=true" >> $GITHUB_ENV; fi
|
||||||
- name: Download artifacts
|
- name: Download artifacts
|
||||||
@@ -34,66 +44,16 @@ jobs:
|
|||||||
wget "$HMCL_CI_DOWNLOAD_BASE_URI/HMCL-$HMCL_VERSION.jar.sha256"
|
wget "$HMCL_CI_DOWNLOAD_BASE_URI/HMCL-$HMCL_VERSION.jar.sha256"
|
||||||
wget "$HMCL_CI_DOWNLOAD_BASE_URI/HMCL-$HMCL_VERSION.sh"
|
wget "$HMCL_CI_DOWNLOAD_BASE_URI/HMCL-$HMCL_VERSION.sh"
|
||||||
wget "$HMCL_CI_DOWNLOAD_BASE_URI/HMCL-$HMCL_VERSION.sh.sha256"
|
wget "$HMCL_CI_DOWNLOAD_BASE_URI/HMCL-$HMCL_VERSION.sh.sha256"
|
||||||
|
env:
|
||||||
|
GH_DOWNLOAD_BASE_URL: https://github.com/HMCL-dev/HMCL/releases/download
|
||||||
- name: Generate release note
|
- name: Generate release note
|
||||||
if: ${{ env.continue == 'true' }}
|
if: ${{ env.continue == 'true' }}
|
||||||
run: |
|
run: |
|
||||||
echo "The full changelogs can be found on the website: https://docs.hmcl.net/changelog/dev.html" >> RELEASE_NOTE
|
if [ "${{ matrix.channel }}" = "stable" ]; then
|
||||||
echo "" >> RELEASE_NOTE
|
echo "**This version is a stable version.**" >> RELEASE_NOTE
|
||||||
echo "*Notice: changelogs are written in Chinese.*" >> RELEASE_NOTE
|
echo "" >> RELEASE_NOTE
|
||||||
echo "" >> RELEASE_NOTE
|
fi
|
||||||
echo "| File Name | SHA-256 Checksum |" >> RELEASE_NOTE
|
echo "The full changelogs can be found on the website: https://docs.hmcl.net/changelog/${{ matrix.channel }}.html" >> RELEASE_NOTE
|
||||||
echo "| --- | --- |" >> RELEASE_NOTE
|
|
||||||
echo "| [HMCL-$HMCL_VERSION.exe]($GH_DOWNLOAD_BASE_URL/v$HMCL_VERSION/HMCL-$HMCL_VERSION.exe) | \`$(cat HMCL-$HMCL_VERSION.exe.sha256)\` |" >> RELEASE_NOTE
|
|
||||||
echo "| [HMCL-$HMCL_VERSION.jar]($GH_DOWNLOAD_BASE_URL/v$HMCL_VERSION/HMCL-$HMCL_VERSION.jar) | \`$(cat HMCL-$HMCL_VERSION.jar.sha256)\` |" >> RELEASE_NOTE
|
|
||||||
echo "| [HMCL-$HMCL_VERSION.sh]($GH_DOWNLOAD_BASE_URL/v$HMCL_VERSION/HMCL-$HMCL_VERSION.sh) | \`$(cat HMCL-$HMCL_VERSION.sh.sha256)\` |" >> RELEASE_NOTE
|
|
||||||
env:
|
|
||||||
GH_DOWNLOAD_BASE_URL: https://github.com/HMCL-dev/HMCL/releases/download
|
|
||||||
- name: Create release
|
|
||||||
if: ${{ env.continue == 'true' }}
|
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
with:
|
|
||||||
body_path: RELEASE_NOTE
|
|
||||||
files: |
|
|
||||||
HMCL-${{ env.HMCL_VERSION }}.exe
|
|
||||||
HMCL-${{ env.HMCL_VERSION }}.jar
|
|
||||||
HMCL-${{ env.HMCL_VERSION }}.sh
|
|
||||||
target_commitish: ${{ env.HMCL_COMMIT_SHA }}
|
|
||||||
name: ${{ env.HMCL_TAG_NAME }}
|
|
||||||
tag_name: ${{ env.HMCL_TAG_NAME }}
|
|
||||||
prerelease: true
|
|
||||||
stable-check-update:
|
|
||||||
if: ${{ github.repository_owner == 'HMCL-dev' }}
|
|
||||||
needs: dev-check-update
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v5
|
|
||||||
- name: Set up JDK
|
|
||||||
uses: actions/setup-java@v5
|
|
||||||
with:
|
|
||||||
distribution: 'temurin'
|
|
||||||
java-version: '25'
|
|
||||||
- name: Fetch tags
|
|
||||||
run: git fetch --all --tags
|
|
||||||
|
|
||||||
- name: Fetch last version
|
|
||||||
run: ./gradlew checkUpdateStable --no-daemon --info --stacktrace
|
|
||||||
- name: Check for existing tags
|
|
||||||
run: if ! git tag -l | grep -q "$HMCL_TAG_NAME"; then echo "continue=true" >> $GITHUB_ENV; fi
|
|
||||||
- name: Download artifacts
|
|
||||||
if: ${{ env.continue == 'true' }}
|
|
||||||
run: |
|
|
||||||
wget "$HMCL_CI_DOWNLOAD_BASE_URI/HMCL-$HMCL_VERSION.exe"
|
|
||||||
wget "$HMCL_CI_DOWNLOAD_BASE_URI/HMCL-$HMCL_VERSION.exe.sha256"
|
|
||||||
wget "$HMCL_CI_DOWNLOAD_BASE_URI/HMCL-$HMCL_VERSION.jar"
|
|
||||||
wget "$HMCL_CI_DOWNLOAD_BASE_URI/HMCL-$HMCL_VERSION.jar.sha256"
|
|
||||||
wget "$HMCL_CI_DOWNLOAD_BASE_URI/HMCL-$HMCL_VERSION.sh"
|
|
||||||
wget "$HMCL_CI_DOWNLOAD_BASE_URI/HMCL-$HMCL_VERSION.sh.sha256"
|
|
||||||
- name: Generate release note
|
|
||||||
if: ${{ env.continue == 'true' }}
|
|
||||||
run: |
|
|
||||||
echo "**This version is a stable version.**" >> RELEASE_NOTE
|
|
||||||
echo "" >> RELEASE_NOTE
|
|
||||||
echo "The full changelogs can be found on the website: https://docs.hmcl.net/changelog/stable.html" >> RELEASE_NOTE
|
|
||||||
echo "" >> RELEASE_NOTE
|
echo "" >> RELEASE_NOTE
|
||||||
echo "*Notice: changelogs are written in Chinese.*" >> RELEASE_NOTE
|
echo "*Notice: changelogs are written in Chinese.*" >> RELEASE_NOTE
|
||||||
echo "" >> RELEASE_NOTE
|
echo "" >> RELEASE_NOTE
|
||||||
|
|||||||
Reference in New Issue
Block a user