Skip to content

Commit f0e1c49

Browse files
committed
Update GitHub Actions workflow to use PAT_TOKEN for releases
1 parent 48facbc commit f0e1c49

File tree

3 files changed

+169
-2
lines changed

3 files changed

+169
-2
lines changed

.github/workflows/build-and-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
- name: Create Release
7373
uses: actions/create-release@v1
7474
env:
75-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
7676
with:
7777
tag_name: v${{ steps.get_version.outputs.version }}
7878
release_name: Release v${{ steps.get_version.outputs.version }}
@@ -94,7 +94,7 @@ jobs:
9494
- name: Upload Release Asset
9595
uses: actions/upload-release-asset@v1
9696
env:
97-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97+
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
9898
with:
9999
upload_url: ${{ steps.create_release.outputs.upload_url }}
100100
asset_path: ./dist/UE-Git-Plugin-Manager.exe

docs/AUTOMATED_RELEASES.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Automated Releases
2+
3+
This project uses GitHub Actions to automatically build and release new versions when changes are pushed to the main branch.
4+
5+
## How it works
6+
7+
1. **Trigger**: Every push to the `main` branch triggers the build and release workflow
8+
2. **Version Control**: The version is controlled by the `VERSION` file in the repository
9+
3. **Building**: The application is built using the same process as `build.bat`
10+
4. **Release**: A new GitHub release is created with the built executable using the version from the VERSION file
11+
12+
## Version Management
13+
14+
- The version is stored in the `VERSION` file (e.g., `1.0.2`)
15+
- **Developer controls the version**: Update the VERSION file to the desired version before pushing
16+
- Version format follows semantic versioning: `MAJOR.MINOR.PATCH`
17+
- The workflow uses whatever version is specified in the VERSION file
18+
19+
### Version Update Process
20+
21+
**Before creating a release:**
22+
1. Update the `VERSION` file to the desired version (e.g., `1.0.2`)
23+
2. Commit and push your changes to the main branch
24+
3. The GitHub Action will automatically create a release with that version
25+
26+
**Example workflow:**
27+
```bash
28+
# Update VERSION file to 1.0.2
29+
echo "1.0.2" > VERSION
30+
31+
# Commit and push
32+
git add VERSION
33+
git commit -m "Prepare release v1.0.2"
34+
git push origin main
35+
36+
# GitHub Action automatically creates release v1.0.2
37+
```
38+
39+
## Manual Release
40+
41+
You can also trigger a release manually:
42+
1. Go to the "Actions" tab in GitHub
43+
2. Select "Build and Release" workflow
44+
3. Click "Run workflow" button
45+
4. Choose the branch (usually `main`) and click "Run workflow"
46+
47+
## Release Assets
48+
49+
Each release includes:
50+
- `UE-Git-Plugin-Manager.exe` - The built executable ready to run
51+
52+
## Workflow Details
53+
54+
The GitHub Action workflow (`/.github/workflows/build-and-release.yml`) performs these steps:
55+
56+
1. **Setup**: Checkout code, setup Go 1.21
57+
2. **Version Reading**: Read version from VERSION file
58+
3. **Build Process**:
59+
- Create necessary directories (`logs`, `dist`)
60+
- Download dependencies (`go mod tidy`)
61+
- Build executable (`go build -o dist/UE-Git-Plugin-Manager.exe .`)
62+
- Verify the executable was created
63+
4. **Release Creation**: Create GitHub release with the version from VERSION file
64+
5. **Asset Upload**: Upload the built executable as a release asset
65+
66+
## Requirements
67+
68+
- Go 1.21 or later
69+
- Windows build environment (GitHub Actions provides this)
70+
- Proper Git permissions for the repository
71+
72+
## Troubleshooting
73+
74+
If the workflow fails:
75+
1. Check the Actions tab for error details
76+
2. Ensure the `VERSION` file exists and contains a valid version number
77+
3. Verify that the Go build process works locally with `build.bat`
78+
4. Check that all dependencies are properly specified in `go.mod`

manage_version.bat

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
@echo off
2+
echo UE Git Plugin Manager - Version Management
3+
echo.
4+
5+
REM Check if VERSION file exists
6+
if not exist "VERSION" (
7+
echo VERSION file not found! Creating with default version...
8+
echo 1.0.1 > VERSION
9+
echo Created VERSION file with version 1.0.1
10+
echo.
11+
)
12+
13+
REM Read current version
14+
set /p CURRENT_VERSION=<VERSION
15+
echo Current version: %CURRENT_VERSION%
16+
17+
echo.
18+
echo Options:
19+
echo 1. Show current version
20+
echo 2. Set patch version (e.g., 1.0.2)
21+
echo 3. Set minor version (e.g., 1.1.0)
22+
echo 4. Set major version (e.g., 2.0.0)
23+
echo 5. Set custom version
24+
echo 6. Exit
25+
echo.
26+
27+
set /p choice="Enter your choice (1-6): "
28+
29+
if "%choice%"=="1" goto show_version
30+
if "%choice%"=="2" goto set_patch
31+
if "%choice%"=="3" goto set_minor
32+
if "%choice%"=="4" goto set_major
33+
if "%choice%"=="5" goto set_custom
34+
if "%choice%"=="6" goto exit
35+
goto invalid_choice
36+
37+
:show_version
38+
echo Current version: %CURRENT_VERSION%
39+
goto end
40+
41+
:set_patch
42+
for /f "tokens=1,2,3 delims=." %%a in ("%CURRENT_VERSION%") do (
43+
set /a NEW_PATCH=%%c+1
44+
set NEW_VERSION=%%a.%%b.!NEW_PATCH!
45+
)
46+
echo %NEW_VERSION% > VERSION
47+
echo Version set to: !NEW_VERSION!
48+
goto end
49+
50+
:set_minor
51+
for /f "tokens=1,2,3 delims=." %%a in ("%CURRENT_VERSION%") do (
52+
set /a NEW_MINOR=%%b+1
53+
set NEW_VERSION=%%a.!NEW_MINOR!.0
54+
)
55+
echo %NEW_VERSION% > VERSION
56+
echo Version set to: !NEW_VERSION!
57+
goto end
58+
59+
:set_major
60+
for /f "tokens=1,2,3 delims=." %%a in ("%CURRENT_VERSION%") do (
61+
set /a NEW_MAJOR=%%a+1
62+
set NEW_VERSION=!NEW_MAJOR!.0.0
63+
)
64+
echo %NEW_VERSION% > VERSION
65+
echo Version set to: !NEW_VERSION!
66+
goto end
67+
68+
:set_custom
69+
set /p NEW_VERSION="Enter new version (e.g., 1.2.3): "
70+
echo %NEW_VERSION% > VERSION
71+
echo Version set to: %NEW_VERSION%
72+
goto end
73+
74+
:invalid_choice
75+
echo Invalid choice. Please enter 1-6.
76+
goto end
77+
78+
:end
79+
echo.
80+
echo Next steps:
81+
echo 1. Commit this change: git add VERSION
82+
echo 2. Commit: git commit -m "Prepare release v%NEW_VERSION%"
83+
echo 3. Push: git push origin main
84+
echo 4. GitHub Action will automatically create the release
85+
echo.
86+
pause
87+
goto exit
88+
89+
:exit

0 commit comments

Comments
 (0)