|
1 | | - |
2 | 1 | name: Create AutoHotkey Release |
3 | 2 |
|
4 | 3 | on: |
5 | | - workflow_dispatch: |
6 | | - push: |
7 | | - tags: |
8 | | - - 'v*' |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + tags: |
| 7 | + - 'v*' |
9 | 8 |
|
10 | 9 | env: |
11 | | - AUH_script_name: '${{ github.event.repository.name }}' |
12 | | - changelog_name: changelog.md |
| 10 | + AUH_script_name: '${{ github.event.repository.name }}' |
| 11 | + changelog_name: changelog.md |
13 | 12 |
|
14 | 13 | jobs: |
15 | | - compile-script: |
16 | | - name: 'Compile Script' |
17 | | - |
18 | | - runs-on: windows-2019 |
19 | | - |
20 | | - env: |
21 | | - AUH_download_link: 'https://www.autohotkey.com/download/1.1/AutoHotkey_1.1.33.02.zip' |
22 | | - AUH_download_name: 'AutoHotkeyDownload.zip' |
23 | | - AUH_download_target_folder: 'AutoHotkeySource' |
24 | | - AUH_exe: 'AutoHotkeyU32.exe' |
| 14 | + compile-script: |
| 15 | + name: 'Compile Script' |
| 16 | + |
| 17 | + runs-on: windows-2022 |
| 18 | + |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v2 |
| 21 | + with: |
| 22 | + fetch-depth: 0 |
| 23 | + submodules: 'recursive' |
| 24 | + |
| 25 | + - name: AutoHotkey Build |
| 26 | + uses: nukdokplex/autohotkey-build@v1 |
| 27 | + with: |
| 28 | + version: 'v1.1.33.02' |
| 29 | + x64: true |
| 30 | + x64_suffix: '' |
| 31 | + x86: false |
| 32 | + in: '${{ env.AUH_script_name }}.ahk' |
| 33 | + out: '.' |
| 34 | + |
| 35 | + - name: Create Changelog From Commit Messages |
| 36 | + run: | |
| 37 | + $targetTagVersion = ("${{ github.ref }}" -split "/")[-1] |
| 38 | + $lastCommitId = "" |
| 39 | + $tags = git tag --sort version:refname |
| 40 | + foreach($tag in $tags) { |
| 41 | + if (-not ($tag -match "^v\d+\.\d+\.\d+$")) { |
| 42 | + continue |
| 43 | + } |
| 44 | + if ($tag -eq "$targetTagVersion") { |
| 45 | + break |
| 46 | + } else { |
| 47 | + $lastCommitId = $tag |
| 48 | + } |
| 49 | + } |
| 50 | + $startCommitId = "" |
| 51 | + if ("" -ne $lastCommitId) { |
| 52 | + $startCommitId = $lastCommitId |
| 53 | + } else { |
| 54 | + $startCommitId = git rev-list --max-parents=0 "$targetTagVersion" |
| 55 | + } |
| 56 | +
|
| 57 | + Write-Host "Collecting commit messages from: '$startCommitId'" |
| 58 | + $messages = git log --pretty="%s" "$startCommitId...$targetTagVersion" |
| 59 | + Write-Host $messages |
| 60 | +
|
| 61 | + Write-Host "Creating markdown from changes..." |
| 62 | + "Changes:`n" > ${{ env.changelog_name }} |
| 63 | + git log --pretty="%s" "$startCommitId...$targetTagVersion" | Sort-Object -Unique {$_} | ForEach-Object {"- $_"} >> ${{ env.changelog_name }} |
| 64 | + Write-Host "Created ${{ env.changelog_name }}" |
25 | 65 |
|
26 | | - steps: |
27 | | - - uses: actions/checkout@v2 |
28 | | - with: |
29 | | - fetch-depth: 0 |
30 | | - submodules: 'recursive' |
| 66 | + - name: Upload Release Sources as an Artifact |
| 67 | + uses: actions/upload-artifact@v4 |
| 68 | + with: |
| 69 | + name: 'ReleaseSources' |
| 70 | + path: | |
| 71 | + ${{ env.AUH_script_name }}.exe |
| 72 | + ${{ env.changelog_name }} |
31 | 73 |
|
32 | | - - name: Provision AutoHotkey Compiler |
33 | | - run: | |
34 | | - Write-Host "Downloading AutoHotkey from '${{ env.AUH_download_link }}'..." |
35 | | - Invoke-WebRequest -Uri "${{ env.AUH_download_link }}" -OutFile "${{ env.AUH_download_name }}" |
36 | | - |
37 | | - Write-Host "Extracting AutoHotkey archive..." |
38 | | - Expand-Archive -Path "${{ env.AUH_download_name }}" -DestinationPath "${{ env.AUH_download_target_folder }}" |
| 74 | + create-release: |
| 75 | + name: 'Create Release' |
39 | 76 |
|
40 | | - - name: Compile AutoHotkey Script |
41 | | - run: | |
42 | | - # Variables |
43 | | - $ahkExePath = "${{ env.AUH_download_target_folder }}\${{ env.AUH_exe }}" |
44 | | - |
45 | | - # Logic |
46 | | - Write-Host "Compiling..." |
47 | | - ."${{ env.AUH_download_target_folder }}\Compiler\Ahk2Exe.exe" /in "${{ env.AUH_script_name }}.ahk" /out "${{ env.AUH_script_name }}.exe" /ahk "$ahkExePath" /compress 0 |
48 | | - |
49 | | - - name: Create Changelog From Commit Messages |
50 | | - run: | |
51 | | - $targetTagVersion = ("${{ github.ref }}" -split "/")[-1] |
52 | | - $lastCommitId = "" |
53 | | - $tags = git tag --sort version:refname |
54 | | - foreach($tag in $tags) { |
55 | | - if (-not ($tag -match "^v\d+\.\d+\.\d+$")) { |
56 | | - continue |
57 | | - } |
58 | | - if ($tag -eq "$targetTagVersion") { |
59 | | - break |
60 | | - } else { |
61 | | - $lastCommitId = $tag |
62 | | - } |
63 | | - } |
64 | | - $startCommitId = "" |
65 | | - if ("" -ne $lastCommitId) { |
66 | | - $startCommitId = $lastCommitId |
67 | | - } else { |
68 | | - $startCommitId = git rev-list --max-parents=0 "$targetTagVersion" |
69 | | - } |
70 | | - |
71 | | - Write-Host "Collecting commit messages from: '$startCommitId'" |
72 | | - $messages = git log --pretty="%s" "$startCommitId...$targetTagVersion" |
73 | | - Write-Host $messages |
74 | | - |
75 | | - Write-Host "Creating markdown from changes..." |
76 | | - "Changes:`n" > ${{ env.changelog_name }} |
77 | | - git log --pretty="%s" "$startCommitId...$targetTagVersion" | Sort-Object -Unique {$_} | ForEach-Object {"- $_"} >> ${{ env.changelog_name }} |
78 | | - Write-Host "Created ${{ env.changelog_name }}" |
79 | | - |
80 | | - - name: Upload Release Sources as an Artifact |
81 | | - uses: actions/upload-artifact@v2.2.1 |
82 | | - with: |
83 | | - name: 'ReleaseSources' |
84 | | - path: | |
85 | | - ${{ env.AUH_script_name }}.exe |
86 | | - ${{ env.changelog_name }} |
87 | | - retention-days: 365 |
| 77 | + runs-on: windows-2022 |
| 78 | + needs: [compile-script] |
88 | 79 |
|
89 | | - create-release: |
90 | | - name: 'Create Release' |
91 | | - |
92 | | - runs-on: windows-2019 |
93 | | - needs: [compile-script] |
| 80 | + steps: |
| 81 | + - name: Download Release Sources Artifact |
| 82 | + uses: actions/download-artifact@v4 |
| 83 | + with: |
| 84 | + name: 'ReleaseSources' |
94 | 85 |
|
95 | | - steps: |
96 | | - - name: Download Release Sources Artifact |
97 | | - uses: actions/download-artifact@v2.0.7 |
98 | | - with: |
99 | | - name: 'ReleaseSources' |
100 | | - |
101 | | - - name: Create Release |
102 | | - id: create_release |
103 | | - uses: actions/create-release@v1 |
104 | | - env: |
105 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
106 | | - with: |
107 | | - tag_name: ${{ github.ref }} |
108 | | - release_name: Release ${{ github.ref }} |
109 | | - body_path: ${{ env.changelog_name }} |
110 | | - draft: true |
111 | | - prerelease: false |
112 | | - |
113 | | - - name: Upload Executable as Release Asset |
114 | | - id: upload-release-asset |
115 | | - uses: actions/upload-release-asset@v1 |
116 | | - env: |
117 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
118 | | - with: |
119 | | - upload_url: ${{ steps.create_release.outputs.upload_url }} |
120 | | - asset_path: '${{ env.AUH_script_name }}.exe' |
121 | | - asset_name: '${{ env.AUH_script_name }}.exe' |
122 | | - asset_content_type: application/zip |
| 86 | + - run: gh release create v3.0.0 --repo "${{ github.repository }}" --draft --verify-tag --title "Release ${{ github.ref }}" --notes-file "${{ env.changelog_name }}" *.exe |
| 87 | + env: |
| 88 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments