From 71a845c1ed124dd00de4b684123c699c1a58043d Mon Sep 17 00:00:00 2001 From: Glavo Date: Wed, 8 Sep 2021 23:03:27 +0800 Subject: [PATCH] create release using github action --- .github/workflows/release.yml | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..bbdbc016f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,44 @@ +name: Create Release + +on: + push: + tags: + - "v*.*.*" + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Check and set HMCL version + run: | + export HMCL_VERSION=`echo ${{ github.ref }} | awk '{print substr($0,12)}'` + echo "HMCL_VERSION=$HMCL_VERSION" >> $GITHUB_ENV + + if [ -z `echo $HMCL_VERSION | grep "^[0-9]\.[0-9]\.[0-9]\{3\}\$"` ]; then + exit 1 + fi + + echo "HMCL_BUILD_NUMBER=`echo $HMCL_VERSION | awk '{print substr($0,5)}'`" >> $GITHUB_ENV + - name: Download artifacts + run: | + wget "$DOWNLOAD_BASE_URL/HMCL-$HMCL_VERSION.exe" + wget "$DOWNLOAD_BASE_URL/HMCL-$HMCL_VERSION.exe.sha1" + wget "$DOWNLOAD_BASE_URL/HMCL-$HMCL_VERSION.jar" + wget "$DOWNLOAD_BASE_URL/HMCL-$HMCL_VERSION.jar.sha1" + env: + DOWNLOAD_BASE_URL: https://ci.huangyuhui.net/job/HMCL/${{ env.HMCL_BUILD_NUMBER }}/artifact/HMCL/build/libs + - name: Generate release note + run: | + echo "HMCL v$HMCL_VERSION" >> RELEASE_NOTE + echo "" >> RELEASE_NOTE + echo "The full changelogs can be found on the website: https://hmcl.huangyuhui.net/changelog/dev.html" >> RELEASE_NOTE + echo "Notice: changelogs are written in Chinese." >> RELEASE_NOTE + - name: Create release + uses: softprops/action-gh-release@v1 + with: + body_path: RELEASE_NOTE + files: | + HMCL-${{ env.HMCL_VERSION }}.exe + HMCL-${{ env.HMCL_VERSION }}.exe.sha1 + HMCL-${{ env.HMCL_VERSION }}.jar + HMCL-${{ env.HMCL_VERSION }}.jar.sha1 \ No newline at end of file