2023-08-08 08:45:26 +08:00
|
|
|
name: Release macOS App
|
|
|
|
|
|
|
|
on:
|
2023-08-09 19:00:41 +08:00
|
|
|
release:
|
|
|
|
types: [ published ]
|
2024-02-26 10:28:26 +08:00
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
tag:
|
|
|
|
description: 'Version tag'
|
|
|
|
required: true
|
|
|
|
default: '1.0.0'
|
2023-08-08 08:45:26 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
release:
|
|
|
|
name: Release macOS App
|
|
|
|
runs-on: macos-latest # We can cross compile but need to be on macOS to notarise
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
platform:
|
2023-08-09 19:00:41 +08:00
|
|
|
- darwin/amd64
|
2023-08-10 17:26:55 +08:00
|
|
|
- darwin/arm64
|
2023-08-09 19:00:41 +08:00
|
|
|
# - darwin/universal
|
2023-08-08 08:45:26 +08:00
|
|
|
steps:
|
|
|
|
- name: Checkout source code
|
2023-08-09 19:00:41 +08:00
|
|
|
uses: actions/checkout@v3
|
2023-08-08 08:45:26 +08:00
|
|
|
|
|
|
|
- name: Normalise platform tag
|
|
|
|
id: normalise_platform
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2023-10-17 21:17:43 +08:00
|
|
|
tag=$(echo ${{ matrix.platform }} | sed -e 's/\//_/g' -e 's/darwin/mac/g' -e 's/amd64/intel/g')
|
2023-08-08 14:45:23 +08:00
|
|
|
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
2023-08-08 08:45:26 +08:00
|
|
|
|
|
|
|
- name: Normalise version tag
|
|
|
|
id: normalise_version
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2024-02-26 10:28:26 +08:00
|
|
|
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
|
2023-08-08 08:45:26 +08:00
|
|
|
|
|
|
|
- name: Setup Go
|
|
|
|
uses: actions/setup-go@v4
|
|
|
|
with:
|
|
|
|
go-version: stable
|
|
|
|
|
2023-08-08 14:45:23 +08:00
|
|
|
# - name: Install gon for macOS notarisation
|
|
|
|
# shell: bash
|
|
|
|
# run: wget https://github.com/mitchellh/gon/releases/download/v0.2.5/gon_macos.zip && unzip gon_macos.zip && mv gon /usr/local/bin
|
|
|
|
#
|
|
|
|
# - name: Import code signing certificate from Github Secrets
|
|
|
|
# uses: Apple-Actions/import-codesign-certs@v1
|
|
|
|
# with:
|
|
|
|
# p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
|
|
|
|
# p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
|
2023-08-08 08:45:26 +08:00
|
|
|
|
|
|
|
- name: Install wails
|
|
|
|
shell: bash
|
2024-09-29 22:40:30 +08:00
|
|
|
run: go install github.com/wailsapp/wails/v2/cmd/wails@v2.9.1
|
2023-08-08 08:45:26 +08:00
|
|
|
|
|
|
|
- name: Setup Node
|
2023-08-16 16:52:02 +08:00
|
|
|
uses: actions/setup-node@v3
|
2023-08-08 08:45:26 +08:00
|
|
|
with:
|
2024-01-18 21:00:02 +08:00
|
|
|
node-version: 18
|
2023-08-08 08:45:26 +08:00
|
|
|
|
|
|
|
- name: Build frontend assets
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2023-09-05 14:43:43 +08:00
|
|
|
npm install -g npm@9
|
2023-08-08 16:33:19 +08:00
|
|
|
jq '.info.productVersion = "${{ steps.normalise_version.outputs.version }}"' wails.json > tmp.json
|
|
|
|
mv tmp.json wails.json
|
2023-08-26 02:39:05 +08:00
|
|
|
cd frontend
|
|
|
|
jq '.version = "${{ steps.normalise_version.outputs.version }}"' package.json > tmp.json
|
|
|
|
mv tmp.json package.json
|
|
|
|
npm install
|
2023-08-08 08:45:26 +08:00
|
|
|
|
|
|
|
- name: Build wails app for macOS
|
|
|
|
shell: bash
|
2023-10-17 10:19:50 +08:00
|
|
|
run: |
|
|
|
|
CGO_ENABLED=1 wails build -platform ${{ matrix.platform }} \
|
2024-04-29 12:06:34 +08:00
|
|
|
-ldflags "-X main.version=${{ steps.normalise_version.outputs.version }} -X main.gaMeasurementID=${{ secrets.GA_MEASUREMENT_ID }} -X main.gaSecretKey=${{ secrets.MAC_GA_SECRET }}"
|
2023-08-08 08:45:26 +08:00
|
|
|
|
2023-08-08 14:45:23 +08:00
|
|
|
# - name: Notarise macOS app + create dmg
|
|
|
|
# shell: bash
|
|
|
|
# run: gon -log-level=info gon.config.json
|
|
|
|
# env:
|
|
|
|
# AC_USERNAME: ${{ secrets.AC_USERNAME }}
|
|
|
|
# AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
|
2023-08-08 08:45:26 +08:00
|
|
|
|
2024-01-18 21:00:02 +08:00
|
|
|
- name: Checkout create-image
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
repository: create-dmg/create-dmg
|
|
|
|
path: ./build/create-dmg
|
|
|
|
ref: master
|
2023-08-19 19:11:46 +08:00
|
|
|
|
|
|
|
- name: Build macOS DMG
|
|
|
|
shell: bash
|
2024-01-18 21:00:02 +08:00
|
|
|
working-directory: ./build
|
2023-08-19 19:11:46 +08:00
|
|
|
run: |
|
2024-01-18 21:00:02 +08:00
|
|
|
mv bin/tinyrdm.app "bin/Tiny RDM.app"
|
|
|
|
./create-dmg/create-dmg \
|
|
|
|
--no-internet-enable \
|
|
|
|
--volname "Tiny RDM" \
|
|
|
|
--volicon "bin/Tiny RDM.app/Contents/Resources/iconfile.icns" \
|
|
|
|
--background "dmg/background.tiff" \
|
|
|
|
--text-size 12 \
|
|
|
|
--window-pos 400 400 \
|
|
|
|
--window-size 660 450 \
|
|
|
|
--icon-size 80 \
|
|
|
|
--icon "Tiny RDM.app" 180 180 \
|
|
|
|
--hide-extension "Tiny RDM.app" \
|
|
|
|
--app-drop-link 480 180 \
|
2024-01-19 00:39:09 +08:00
|
|
|
--add-file "Repair" "dmg/fix-app" 230 290 \
|
|
|
|
--add-file "损坏修复" "dmg/fix-app_zh" 430 290 \
|
2024-01-18 21:00:02 +08:00
|
|
|
"bin/TinyRDM-${{ steps.normalise_platform.outputs.tag }}.dmg" \
|
|
|
|
"bin"
|
2023-08-19 19:11:46 +08:00
|
|
|
|
2024-02-22 00:10:48 +08:00
|
|
|
- name: Rename dmg
|
|
|
|
working-directory: ./build/bin
|
|
|
|
run: mv "TinyRDM-${{ steps.normalise_platform.outputs.tag }}.dmg" "TinyRDM_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.dmg"
|
|
|
|
|
2023-08-19 19:11:46 +08:00
|
|
|
- name: Upload release asset (DMG Package)
|
2024-02-22 00:10:48 +08:00
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
with:
|
2024-02-26 10:28:26 +08:00
|
|
|
tag_name: v${{ steps.normalise_version.outputs.version }}
|
2024-02-22 00:10:48 +08:00
|
|
|
files: ./build/bin/TinyRDM_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.dmg
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|