Skip to content

Update GitHub Actions workflow to use PAT_TOKEN for releases #3

Update GitHub Actions workflow to use PAT_TOKEN for releases

Update GitHub Actions workflow to use PAT_TOKEN for releases #3

name: Build and Release
on:
push:
branches: [ main ]
workflow_dispatch: # Allow manual triggering
jobs:
build-and-release:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch full history for version bumping
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Get version from VERSION file
id: get_version
run: |
$version = Get-Content VERSION -Raw
$version = $version.Trim()
Write-Host "Building release for version: $version"
echo "version=$version" >> $env:GITHUB_OUTPUT
- name: Create logs directory
run: |
if (-not (Test-Path "logs")) {
New-Item -ItemType Directory -Path "logs"
}
- name: Download dependencies
run: |
go mod tidy
- name: Create dist directory
run: |
if (-not (Test-Path "dist")) {
New-Item -ItemType Directory -Path "dist"
}
- name: Build executable
run: |
Write-Host "Building UE-Git-Plugin-Manager.exe..."
go build -o dist/UE-Git-Plugin-Manager.exe .
if ($LASTEXITCODE -ne 0) {
Write-Error "Build failed!"
exit 1
}
Write-Host "Build successful!"
- name: Verify executable
run: |
if (Test-Path "dist/UE-Git-Plugin-Manager.exe") {
$fileSize = (Get-Item "dist/UE-Git-Plugin-Manager.exe").Length
Write-Host "Executable created successfully. Size: $fileSize bytes"
} else {
Write-Error "Executable not found!"
exit 1
}
- name: Log version info
run: |
Write-Host "Building release for version: ${{ steps.get_version.outputs.version }}"
Write-Host "Version is controlled by the VERSION file in the repository"
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
with:
tag_name: v${{ steps.get_version.outputs.version }}
release_name: Release v${{ steps.get_version.outputs.version }}
body: |
## Changes in v${{ steps.get_version.outputs.version }}
This release includes the latest changes from the main branch.
### Download
Download the `UE-Git-Plugin-Manager.exe` file below and run it to use the latest version.
### Installation
1. Download `UE-Git-Plugin-Manager.exe`
2. Run the executable
3. Follow the setup wizard
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/UE-Git-Plugin-Manager.exe
asset_name: UE-Git-Plugin-Manager.exe
asset_content_type: application/octet-stream