diff --git a/.github/workflows/macos_build.yml b/.github/workflows/macos_build.yml new file mode 100644 index 00000000..d1d308a8 --- /dev/null +++ b/.github/workflows/macos_build.yml @@ -0,0 +1,95 @@ +name: Release +on: + push: + tags: + - 'v*' + +jobs: + build-macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - name: Rust Cache + uses: Swatinem/rust-cache@v1.2.0 + - name: rust-cargo + uses: actions-rs/cargo@v1.0.3 + with: + command: install + args: pyoxidizer + - name: Build Hydrus + run: | + cd $GITHUB_WORKSPACE + basename $(rustc --print sysroot) | sed -e "s/^stable-//" > triple.txt + pyoxidizer build --release + cd build/$(head -n 1 triple.txt)/release + mkdir -p "Hydrus Network.app/Contents/MacOS" + mkdir -p "Hydrus Network.app/Contents/Resources" + mkdir -p "Hydrus Network.app/Contents/Frameworks" + mv install/static/icon.icns "Hydrus Network.app/Contents/Resources/icon.icns" + cat > "Hydrus Network.app/Contents/Info.plist" < + + + + CFBundleDisplayName + client + CFBundleExecutable + MacOS/client + CFBundleIconFile + icon.icns + CFBundleIdentifier + client + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + client + CFBundlePackageType + APPL + CFBundleShortVersionString + 0.0.0 + NSHighResolutionCapable + True + + EOF + mv install/* "Hydrus Network.app/Contents/MacOS/" + rm -rf install + cd $GITHUB_WORKSPACE + temp_dmg="$(mktemp).dmg" + hdiutil create "$temp_dmg" -ov -volname "HydrusNetwork" -fs HFS+ -srcfolder "$GITHUB_WORKSPACE/build/$(head -n 1 triple.txt)/release" + hdiutil convert "$temp_dmg" -format UDZO -o HydrusNetwork.dmg + - name: Upload a Build Artifact + uses: actions/upload-artifact@v2.2.1 + with: + name: MacOS-DMG + path: HydrusNetwork.dmg + if-no-files-found: error + retention-days: 2 + + create-release: + name: Create Release Entry + runs-on: ubuntu-20.04 + needs: [build-macos] + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Get All Artifacts + uses: actions/download-artifact@v2 + - name: Extract version metadata + id: meta + run: | + echo "::set-output name=version::${GITHUB_REF##*/}" + echo "::set-output name=version_short::${GITHUB_REF##*/v}" + - name: Rename Files + run: | + mv MacOS-DMG/HydrusNetwork.dmg HydrusNetwork-${{ steps.meta.outputs.version }}.dmg + - name: Release new + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + HydrusNetwork-${{ steps.meta.outputs.version }}.dmg + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file