CI: Fixed tag reference #13
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Create AutoHotkey Release | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - 'v*' | |
| env: | |
| AUH_script_name: '${{ github.event.repository.name }}' | |
| changelog_name: changelog.md | |
| jobs: | |
| compile-script: | |
| name: 'Compile Script' | |
| runs-on: windows-2022 | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 0 | |
| submodules: 'recursive' | |
| - name: AutoHotkey Build | |
| uses: nukdokplex/autohotkey-build@v1 | |
| with: | |
| version: 'v1.1.33.02' | |
| x64: true | |
| x64_suffix: '' | |
| x86: false | |
| in: '${{ env.AUH_script_name }}.ahk' | |
| out: '.' | |
| - name: Create Changelog From Commit Messages | |
| run: | | |
| $targetTagVersion = ("${{ github.ref }}" -split "/")[-1] | |
| $lastCommitId = "" | |
| $tags = git tag --sort version:refname | |
| foreach($tag in $tags) { | |
| if (-not ($tag -match "^v\d+\.\d+\.\d+$")) { | |
| continue | |
| } | |
| if ($tag -eq "$targetTagVersion") { | |
| break | |
| } else { | |
| $lastCommitId = $tag | |
| } | |
| } | |
| $startCommitId = "" | |
| if ("" -ne $lastCommitId) { | |
| $startCommitId = $lastCommitId | |
| } else { | |
| $startCommitId = git rev-list --max-parents=0 "$targetTagVersion" | |
| } | |
| Write-Host "Collecting commit messages from: '$startCommitId'" | |
| $messages = git log --pretty="%s" "$startCommitId...$targetTagVersion" | |
| Write-Host $messages | |
| Write-Host "Creating markdown from changes..." | |
| "Changes:`n" > ${{ env.changelog_name }} | |
| git log --pretty="%s" "$startCommitId...$targetTagVersion" | Sort-Object -Unique {$_} | ForEach-Object {"- $_"} >> ${{ env.changelog_name }} | |
| Write-Host "Created ${{ env.changelog_name }}" | |
| - name: Upload Release Sources as an Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: 'ReleaseSources' | |
| path: | | |
| ${{ env.AUH_script_name }}.exe | |
| ${{ env.changelog_name }} | |
| create-release: | |
| name: 'Create Release' | |
| runs-on: windows-2022 | |
| needs: [compile-script] | |
| steps: | |
| - name: Download Release Sources Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: 'ReleaseSources' | |
| - run: gh release create "${{ github.ref_name }}" --repo "${{ github.repository }}" --draft --verify-tag --title "Release ${{ github.ref_name }}" --notes-file "${{ env.changelog_name }}" *.exe | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |