chore: add manual trigger to github action

This commit is contained in:
Lykin 2024-02-26 10:28:26 +08:00
parent 23b68d9e19
commit 53563acac0
3 changed files with 51 additions and 12 deletions

View File

@ -3,6 +3,12 @@ name: Release Linux App
on:
release:
types: [ published ]
workflow_dispatch:
inputs:
tag:
description: 'Version tag'
required: true
default: '1.0.0'
jobs:
release:
@ -27,8 +33,13 @@ jobs:
id: normalise_version
shell: bash
run: |
if [ "${{ github.event.release.tag_name }}" == "" ]; then
version=$(echo ${{ github.event.inputs.tag }} | sed -e 's/v//g')
echo "version=$version" >> "$GITHUB_OUTPUT"
else
version=$(echo ${{ github.event.release.tag_name }} | sed -e 's/v//g')
echo "version=$version" >> "$GITHUB_OUTPUT"
fi
- name: Setup Go
uses: actions/setup-go@v4
@ -65,7 +76,7 @@ jobs:
shell: bash
run: |
CGO_ENABLED=1 wails build -platform ${{ matrix.platform }} \
-ldflags "-X main.version=${{ github.event.release.tag_name }} -X main.gaMeasurementID=${{ secrets.GA_MEASUREMENT_ID }} -X main.gaSecretKey=${{ secrets.LINUX_GA_SECRET }}" \
-ldflags "-X main.version=v${{ steps.normalise_version.outputs.version }} -X main.gaMeasurementID=${{ secrets.GA_MEASUREMENT_ID }} -X main.gaSecretKey=${{ secrets.LINUX_GA_SECRET }}" \
-o tiny-rdm
- name: Setup control template
@ -105,5 +116,6 @@ jobs:
- name: Upload release asset
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.normalise_version.outputs.version }}
files: ./build/linux/tiny-rdm_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.deb
token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -3,6 +3,12 @@ name: Release macOS App
on:
release:
types: [ published ]
workflow_dispatch:
inputs:
tag:
description: 'Version tag'
required: true
default: '1.0.0'
jobs:
release:
@ -29,8 +35,13 @@ jobs:
id: normalise_version
shell: bash
run: |
if [ "${{ github.event.release.tag_name }}" == "" ]; then
version=$(echo ${{ github.event.inputs.tag }} | sed -e 's/v//g')
echo "version=$version" >> "$GITHUB_OUTPUT"
else
version=$(echo ${{ github.event.release.tag_name }} | sed -e 's/v//g')
echo "version=$version" >> "$GITHUB_OUTPUT"
fi
- name: Setup Go
uses: actions/setup-go@v4
@ -116,5 +127,6 @@ jobs:
- name: Upload release asset (DMG Package)
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.normalise_version.outputs.version }}
files: ./build/bin/TinyRDM_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.dmg
token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -3,6 +3,12 @@ name: Release Windows App
on:
release:
types: [ published ]
workflow_dispatch:
inputs:
tag:
description: 'Version tag'
required: true
default: '1.0.0'
jobs:
release:
@ -25,16 +31,23 @@ jobs:
echo "tag=$tag" >> "$GITHUB_OUTPUT"
- name: Normalise platform name
id: platform_name
id: normalise_platform_name
shell: bash
run: tag=$(echo ${{ matrix.platform }} | sed -e 's/\//_/g')
run: |
pname=$(echo ${{ matrix.platform }} | sed -e 's/\//_/g')
echo "pname=$pname" >> "$GITHUB_OUTPUT"
- name: Normalise version tag
id: normalise_version
shell: bash
run: |
if [ "${{ github.event.release.tag_name }}" == "" ]; then
version=$(echo ${{ github.event.inputs.tag }} | sed -e 's/v//g')
echo "version=$version" >> "$GITHUB_OUTPUT"
else
version=$(echo ${{ github.event.release.tag_name }} | sed -e 's/v//g')
echo "version=$version" >> "$GITHUB_OUTPUT"
fi
- name: Setup Go
uses: actions/setup-go@v4
@ -71,7 +84,7 @@ jobs:
run: |
CGO_ENABLED=1 wails build -clean -platform ${{ matrix.platform }} \
-webview2 embed \
-ldflags "-X main.version=${{ github.event.release.tag_name }} -X main.gaMeasurementID=${{ secrets.GA_MEASUREMENT_ID }} -X main.gaSecretKey=${{ secrets.WINDOWS_GA_SECRET }}"
-ldflags "-X main.version=v${{ steps.normalise_version.outputs.version }} -X main.gaMeasurementID=${{ secrets.GA_MEASUREMENT_ID }} -X main.gaSecretKey=${{ secrets.WINDOWS_GA_SECRET }}"
- name: Compress portable binary
working-directory: ./build/bin
@ -80,6 +93,7 @@ jobs:
- name: Upload release asset (Portable)
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.normalise_version.outputs.version }}
files: ./build/bin/TinyRDM_Portable_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.zip
token: ${{ secrets.GITHUB_TOKEN }}
@ -88,7 +102,7 @@ jobs:
run: |
CGO_ENABLED=1 wails build -clean -platform ${{ matrix.platform }} \
-nsis -webview2 embed \
-ldflags "-X main.version=${{ github.event.release.tag_name }}"
-ldflags "-X main.version=v${{ steps.normalise_version.outputs.version }}"
- name: Codesign Windows NSIS installer
working-directory: ./build/bin
@ -98,7 +112,7 @@ jobs:
Set-Content -Path certificate\certificate.txt -Value '${{ secrets.WIN_SIGNING_CERT }}'
certutil -decode certificate\certificate.txt certificate\certificate.pfx
echo "Signing TinyRDM installer"
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /fd sha256 /tr http://ts.ssl.com /f certificate\certificate.pfx /p '${{ secrets.WIN_SIGNING_CERT_PASSWORD }}' TinyRDM-${{ matrix.platform }}-installer.exe
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /fd sha256 /tr http://ts.ssl.com /f certificate\certificate.pfx /p '${{ secrets.WIN_SIGNING_CERT_PASSWORD }}' TinyRDM-${{ steps.normalise_platform_name.outputs.pname }}-installer.exe
- name: Rename installer
working-directory: ./build/bin
@ -107,5 +121,6 @@ jobs:
- name: Upload release asset (Installer)
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.normalise_version.outputs.version }}
files: ./build/bin/TinyRDM_Setup_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.exe
token: ${{ secrets.GITHUB_TOKEN }}