From 583786e4eb56547c15dc5244594b32a979344bac Mon Sep 17 00:00:00 2001 From: neCo <50079394+neCo2@users.noreply.github.com> Date: Wed, 22 May 2024 22:54:17 +0200 Subject: [PATCH] test release workflow --- .github/workflows/compile_mikupad.yml | 29 ++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/.github/workflows/compile_mikupad.yml b/.github/workflows/compile_mikupad.yml index 68cdaf0..99bacdf 100644 --- a/.github/workflows/compile_mikupad.yml +++ b/.github/workflows/compile_mikupad.yml @@ -16,22 +16,31 @@ jobs: fetch-depth: 0 ref: main + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + - name: run compile.sh + run: chmod +x compile.sh; ./compile.sh - name: Determine Tag and Build Names - id: Tag_Name + id: build_ids run: | + # use number of commits as build ID + BUILD_NUMBER="$(git rev-list --count HEAD)" echo "number=${BUILD_NUMBER}" >> $GITHUB_OUTPUT SHORT_HASH="$(git rev-parse --short=7 HEAD)" echo "buildName=Mikupad #${BUILD_NUMBER} [${SHORT_HASH}]" >> $GITHUB_OUTPUT - echo ${BUILD_NUMBER} - echo ${SHORT_HASH} + + echo "Build: $BUILD_NUMBER $SHORT_HASH - name: Get Last Release Tag id: last_release run: | + # find previous release to determine how many commits should be displayed in the changelog TAG=$(git tag --list 'release*' --sort=-v:refname | head -n 1) if [ -z "$TAG" ]; then echo "No release tag found" @@ -45,15 +54,17 @@ jobs: - name: Generate Changelog id: changelog run: | + # if no previous release, don't dump the entire history if [ "${{ steps.last_release.outputs.tag }}" = "none" ]; then echo "mikudayo~" > CHANGELOG.txt else NEW_COMMIT="${{ steps.last_release.outputs.tag }}" - NUM_COMMITS="${{ steps.Tag_Name.outputs.number }}" - echo "$(($NUM_COMMITS - $NEW_COMMIT))" + NUM_COMMITS="${{ steps.build_ids.outputs.number }}" N_COMMITS="$(($NUM_COMMITS - $NEW_COMMIT))" - echo "Generating changelog starting from commit $NEW_COMMIT" - echo "$(date +'%Y-%m-%d %T')" >> CHANGELOG.txt + echo "Generating changelog with $NUM_COMMITS commits to reach $NEW_COMMIT" + + # echo changelog + echo "Generated $(date +'%Y-%m-%d %T')" >> CHANGELOG.txt echo "\`\`\`" >> CHANGELOG.txt echo "$(git log --graph -n $N_COMMITS --oneline)" >> CHANGELOG.txt echo "\`\`\`" >> CHANGELOG.txt @@ -63,8 +74,8 @@ jobs: - name: Release uses: softprops/action-gh-release@v2 with: - tag_name: release${{ steps.Tag_Name.outputs.number }} - name: ${{ steps.Tag_Name.outputs.buildName }} + tag_name: release${{ steps.build_ids.outputs.number }} + name: ${{ steps.build_ids.outputs.buildName }} body_path: CHANGELOG.txt files: mikupad_compiled.html token: ${{ secrets.GITHUB_TOKEN }}