Skip to content

Commit a499f1d

Browse files
authored
Update GitHub Actions workflow for auto build and release
1 parent 2445a1b commit a499f1d

1 file changed

Lines changed: 19 additions & 7 deletions

File tree

.github/workflows/blank.yml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,48 @@
1-
name: Build and Release
1+
name: Auto Build and Release
22

33
on:
44
push:
5-
tags:
6-
- 'v*'
5+
branches:
6+
- main # Trigger on every push to main
77
workflow_dispatch:
88

9+
permissions:
10+
contents: write # Crucial: Allows the bot to create tags and releases
11+
912
jobs:
1013
build:
1114
runs-on: windows-latest
1215

1316
steps:
1417
- name: Checkout code
1518
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0 # Fetches all history so it can push tags back
1621

1722
- name: Setup MSVC
1823
uses: ilammy/msvc-dev-cmd@v1
1924
with:
20-
arch: x86 # Crucial for finding ml.exe
25+
arch: x86
2126

2227
- name: Run Build Script
2328
shell: cmd
2429
run: |
25-
:: If you haven't uploaded an icon yet, this creates a dummy one
26-
:: so the resource compiler doesn't crash.
2730
if not exist app_icon.ico echo. > app_icon.ico
2831
call build.bat
2932
33+
- name: Create and Push Tag
34+
shell: bash
35+
run: |
36+
# Creates a unique tag using the build number
37+
TAG_NAME="v0.1.${{ github.run_number }}"
38+
git tag $TAG_NAME
39+
git push origin $TAG_NAME
40+
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
41+
3042
- name: Create Release
3143
uses: softprops/action-gh-release@v2
32-
if: startsWith(github.ref, 'refs/tags/')
3344
with:
3445
files: clicker.exe
46+
tag_name: ${{ env.TAG_NAME }} # Uses the tag we just created
3547
env:
3648
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)