feat: add release windows actions

This commit is contained in:
tiny-craft 2023-08-10 17:26:55 +08:00
parent 0b02e01ade
commit 99d0ab075c
3 changed files with 103 additions and 14 deletions

View File

@ -95,7 +95,8 @@ jobs:
- name: Upload release asset - name: Upload release asset
shell: bash shell: bash
run: | run: |
filepath="./build/linux/tiny-rdm_${{ steps.normalise_version.outputs.version }}_amd64.deb" filepath="tiny-rdm_${{ steps.normalise_version.outputs.version }}_amd64.deb"
filename="tiny-rdm_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.deb" filename="tiny-rdm_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.deb"
upload_url="https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${{ github.event.release.id }}/assets" upload_url="https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${{ github.event.release.id }}/assets"
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Content-Type: application/octet-stream" --data-binary @$filepath "$upload_url?name=$filename" curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Content-Type: application/octet-stream" --data-binary @$filepath "$upload_url?name=$filename"
working-directory: ./build/bin/

View File

@ -12,7 +12,7 @@ jobs:
matrix: matrix:
platform: platform:
- darwin/amd64 - darwin/amd64
# - darwin/arm64 - darwin/arm64
# - darwin/universal # - darwin/universal
steps: steps:
- name: Checkout source code - name: Checkout source code
@ -93,18 +93,8 @@ jobs:
- name: Upload release asset - name: Upload release asset
shell: bash shell: bash
run: | run: |
filepath="./build/bin/TinyRDM-${{ steps.normalise_platform.outputs.tag }}.zip" filepath="TinyRDM-${{ steps.normalise_platform.outputs.tag }}.zip"
filename="TinyRDM_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.zip" filename="TinyRDM_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.zip"
upload_url="https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${{ github.event.release.id }}/assets" upload_url="https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${{ github.event.release.id }}/assets"
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Content-Type: application/zip" --data-binary @$filepath "$upload_url?name=$filename" curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Content-Type: application/zip" --data-binary @$filepath "$upload_url?name=$filename"
working-directory: ./build/bin/
# - name: Upload artifact
# uses: actions/upload-release-asset@v1.0.2
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ARTIFACT_NAME: TinyRDM_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}
# with:
# upload_url: ${{ steps.get_upload_url.outputs.url }}
# asset_path: ./build/bin/TinyRDM-${{ steps.normalise_platform.outputs.tag }}.zip
# asset_name: ${{ env.ARTIFACT_NAME }}.zip
# asset_content_type: application/zip

98
.github/workflows/release-windows.yaml vendored Normal file
View File

@ -0,0 +1,98 @@
name: Release Windows App
on:
release:
types: [ published ]
jobs:
release:
name: Release Windows App
runs-on: windows-latest
strategy:
matrix:
platform:
- windows/amd64
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Normalise platform tag
id: normalise_platform
shell: bash
run: |
tag=$(echo ${{ matrix.platform }} | sed -e 's/\//_/g')
echo "tag=$tag" >> "$GITHUB_OUTPUT"
- name: Normalise version tag
id: normalise_version
shell: bash
run: |
version=$(echo ${{ github.event.release.tag_name }} | sed -e 's/v//g')
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: stable
- name: Install makensis
uses: crazy-max/ghaction-chocolatey@v2
with:
args: install nsis jq
- name: Install wails
shell: bash
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Build frontend assets
shell: bash
run: |
npm install -g npm
jq '.info.productVersion = "${{ steps.normalise_version.outputs.version }}"' wails.json > tmp.json
mv tmp.json wails.json
cd frontend && npm install
- name: Build Windows portable app
shell: bash
run: CGO_ENABLED=1 wails build -clean -platform ${{ matrix.platform }} -ldflags "-X main.version=${{ github.event.release.tag_name }}"
- name: Compress portable binary
run: Compress-Archive "Tiny RDM.exe" tiny-rdm.zip
working-directory: ./build/bin
- name: Upload release asset (Portable)
shell: bash
run: |
filepath="tiny-rdm.zip"
filename="TinyRDM_Portable_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.zip"
upload_url="https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${{ github.event.release.id }}/assets"
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Content-Type: application/zip" --data-binary @$filepath "$upload_url?name=$filename"
working-directory: ./build/bin
- name: Build Windows NSIS installer
shell: bash
run: CGO_ENABLED=1 wails build -clean -platform ${{ matrix.platform }} -nsis -ldflags "-X main.version=${{ github.event.release.tag_name }}"
- name: Codesign Windows NSIS installer
run: |
echo "Creating certificate file"
New-Item -ItemType directory -Path certificate
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-amd64-installer.exe
working-directory: ./build/bin
- name: Upload release asset (Installer)
shell: bash
run: |
filepath="TinyRDM-amd64-installer.exe"
filename="TinyRDM_Setup_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.exe"
upload_url="https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${{ github.event.release.id }}/assets"
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Content-Type: application/octet-stream" --data-binary @$filepath "$upload_url?name=$filename"
working-directory: ./build/bin/