name: Release macOS App on: release: types: [ published ] 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: - darwin/amd64 - darwin/arm64 # - darwin/universal 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' -e 's/darwin/mac/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 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 }} - name: Install wails shell: bash run: go install github.com/wailsapp/wails/v2/cmd/wails@latest - name: Setup Node uses: actions/setup-node@v3 with: node-version: 16 - name: Build frontend assets shell: bash run: | npm install -g npm@9 jq '.info.productVersion = "${{ steps.normalise_version.outputs.version }}"' wails.json > tmp.json mv tmp.json wails.json cd frontend jq '.version = "${{ steps.normalise_version.outputs.version }}"' package.json > tmp.json mv tmp.json package.json npm install - name: Build wails app for macOS shell: bash run: CGO_ENABLED=1 wails build -platform ${{ matrix.platform }} -ldflags "-X main.version=${{ github.event.release.tag_name }}" # - 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 }} - name: Compress macOS app shell: bash working-directory: ./build/bin run: | mv tinyrdm.app "Tiny RDM.app" zip -r TinyRDM-${{ steps.normalise_platform.outputs.tag }}.zip "Tiny RDM.app" - name: Upload release asset (ZIP Package) shell: bash working-directory: ./build/bin/ run: | filepath="TinyRDM-${{ 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" curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Content-Type: application/zip" --data-binary @$filepath "$upload_url?name=$filename" - name: Build macOS DMG shell: bash working-directory: ./build/bin run: | rm TinyRDM-${{ steps.normalise_platform.outputs.tag }}.zip ln -s /Applications Applications hdiutil create -volname "Tiny RDM" -srcfolder . -ov -format UDBZ TinyRDM-${{ steps.normalise_platform.outputs.tag }}.dmg - name: Upload release asset (DMG Package) shell: bash working-directory: ./build/bin/ run: | filepath="TinyRDM-${{ steps.normalise_platform.outputs.tag }}.dmg" filename="TinyRDM_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.dmg" 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/x-apple-diskimage" --data-binary @$filepath "$upload_url?name=$filename"