Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 04065a0dd1 | |||
| 47628638e2 | |||
| 39dfbfc618 | |||
| 63bb8f463d | |||
| e393fc5b6b | |||
| 57eb55cb23 | |||
| 1cdfffa4f8 | |||
| edfc168cab |
@@ -1,65 +0,0 @@
|
|||||||
name: Release Build
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-and-release:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Go
|
|
||||||
uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: '1.24'
|
|
||||||
cache: true
|
|
||||||
|
|
||||||
- name: Get Version
|
|
||||||
id: get_version
|
|
||||||
run: |
|
|
||||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
|
||||||
VERSION=${GITHUB_REF#refs/tags/v}
|
|
||||||
else
|
|
||||||
VERSION="0.0.0-dev"
|
|
||||||
fi
|
|
||||||
echo "Detected Version: $VERSION"
|
|
||||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Update Version in Files
|
|
||||||
run: |
|
|
||||||
echo "Updating version in PrintCleaner.manifest to ${VERSION}.0"
|
|
||||||
# Update Manifest (Format: 1.0.0.0)
|
|
||||||
sed -i "s/version=\"[0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]*\"/version=\"${VERSION}.0\"/" PrintCleaner.manifest
|
|
||||||
|
|
||||||
echo "Updating version in PrintCleaner.ps1 to ${VERSION}"
|
|
||||||
# Update PowerShell Script
|
|
||||||
sed -i "s/\$AppVersion = \"0.0.0\"/\$AppVersion = \"${VERSION}\"/" PrintCleaner.ps1
|
|
||||||
|
|
||||||
- name: Generate Resources (Icon & Manifest)
|
|
||||||
run: |
|
|
||||||
# Install rsrc dependency if not present (handled by go.mod, but go run ensures it)
|
|
||||||
go run github.com/akavel/rsrc -manifest PrintCleaner.manifest -ico icon.ico -arch amd64 -o rsrc.syso
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
output_name="PrintCleaner_v${VERSION}.exe"
|
|
||||||
echo "Building $output_name..."
|
|
||||||
GOOS=windows GOARCH=amd64 go build -o "$output_name" main.go
|
|
||||||
echo "ARTIFACT_NAME=$output_name" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Create Release
|
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
|
||||||
with:
|
|
||||||
files: ${{ env.ARTIFACT_NAME }}
|
|
||||||
draft: false
|
|
||||||
prerelease: false
|
|
||||||
generate_release_notes: true
|
|
||||||
51
.github/workflows/release.yml
vendored
51
.github/workflows/release.yml
vendored
@@ -56,10 +56,49 @@ jobs:
|
|||||||
echo "ARTIFACT_NAME=$output_name" >> $GITHUB_ENV
|
echo "ARTIFACT_NAME=$output_name" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
with:
|
env:
|
||||||
files: ${{ env.ARTIFACT_NAME }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
draft: false
|
run: |
|
||||||
prerelease: false
|
# Define Variables
|
||||||
generate_release_notes: true
|
TAG_NAME=${GITHUB_REF#refs/tags/}
|
||||||
|
API_URL="${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases"
|
||||||
|
FILE_NAME="${{ env.ARTIFACT_NAME }}"
|
||||||
|
|
||||||
|
echo "Creating release for $TAG_NAME on Gitea..."
|
||||||
|
|
||||||
|
# 1. Create Release
|
||||||
|
RESPONSE=$(curl -s -X POST "$API_URL" \
|
||||||
|
-H "Authorization: token $GITHUB_TOKEN" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{
|
||||||
|
\"tag_name\": \"$TAG_NAME\",
|
||||||
|
\"name\": \"$TAG_NAME\",
|
||||||
|
\"body\": \"Automated release for $TAG_NAME\",
|
||||||
|
\"draft\": false,
|
||||||
|
\"prerelease\": false
|
||||||
|
}")
|
||||||
|
|
||||||
|
# Extract Release ID (simple grep fallback)
|
||||||
|
RELEASE_ID=$(echo "$RESPONSE" | grep -o '"id": *[0-9]*' | head -1 | grep -o '[0-9]*')
|
||||||
|
|
||||||
|
if [ -z "$RELEASE_ID" ]; then
|
||||||
|
echo "Error: Failed to create release. API Response:"
|
||||||
|
echo "$RESPONSE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Release created with ID: $RELEASE_ID"
|
||||||
|
|
||||||
|
# 2. Upload Asset
|
||||||
|
# Gitea API: POST /repos/{owner}/{repo}/releases/{id}/assets
|
||||||
|
UPLOAD_URL="${API_URL}/${RELEASE_ID}/assets"
|
||||||
|
|
||||||
|
echo "Uploading artifact: $FILE_NAME to $UPLOAD_URL"
|
||||||
|
|
||||||
|
curl -f -X POST "$UPLOAD_URL?name=$FILE_NAME" \
|
||||||
|
-H "Authorization: token $GITHUB_TOKEN" \
|
||||||
|
-H "Content-Type: application/octet-stream" \
|
||||||
|
--data-binary "@$FILE_NAME"
|
||||||
|
|
||||||
|
echo "Asset uploaded successfully."
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<assemblyIdentity
|
<assemblyIdentity
|
||||||
type="win32"
|
type="win32"
|
||||||
name="PrintCleaner.App"
|
name="PrintCleaner.App"
|
||||||
version="1.0.28.0"
|
version="1.0.35.0"
|
||||||
processorArchitecture="amd64"
|
processorArchitecture="amd64"
|
||||||
/>
|
/>
|
||||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
|||||||
Reference in New Issue
Block a user