[deployment] try fixing android jdk for build #116
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: [push, pull_request] | |
# this from from https://github.com/sunshine-protocol/sunscreen Appache 2.0 license | |
# | |
# name is (urlencode) connected to README.md svg badge (change it there as well) | |
name: MacOS Build | |
jobs: | |
build: | |
name: Compile and Build - MacOS | |
runs-on: macos-latest | |
steps: | |
# use to your like https://github.com/marketplace?type=actions | |
# #################### build conditions | |
- name: vtag variable | |
shell: bash | |
run: echo "vtag=$(echo ${GITHUB_REF#refs/tags/} | awk '/v([0-9]+\.)+[0-9]+/{print $0}')" >> $GITHUB_ENV | |
- name: Extractor for vtag env | |
id: extract_tag | |
shell: bash | |
run: echo "{tag}==${{ env.vtag }}" >> $GITHUB_OUTPUT | |
- name: Release | |
if: steps.extract_tag.outputs.tag != null | |
shell: bash | |
run: echo "Building release" | |
# ############################# Tester | |
- name: Tester for anything github actions releated but only in debug | |
if: steps.extract_tag.outputs.tag == null | |
continue-on-error: true | |
shell: bash | |
run: >- | |
echo | |
"Testing yml feature" | |
&& echo " of line break" | |
# ############################### Installation | |
# https://github.com/create-dmg/create-dmg | |
- name: Install Installer Helper | |
if: steps.extract_tag.outputs.tag != null | |
run: brew install create-dmg | |
# ##################### setup build environment | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Install Rust Toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
components: rustfmt | |
- name: Cache Cargo | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
~/.cargo/bin | |
target/x86_64-apple-darwin | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install MacOS Targets | |
run: rustup target add x86_64-apple-darwin | |
# ############### Release/Debug build dependent | |
- name: Run cargo make MacOS - Release | |
if: steps.extract_tag.outputs.tag != null | |
uses: actions-rs/cargo@v1 | |
continue-on-error: false | |
with: | |
command: build | |
args: --bin audiobookfinder --release --target x86_64-apple-darwin | |
- name: Run cargo make MacOS - Debug | |
if: steps.extract_tag.outputs.tag == null | |
uses: actions-rs/cargo@v1 | |
continue-on-error: false | |
with: | |
command: build | |
args: --bin audiobookfinder --target x86_64-apple-darwin | |
# ######################### compress binary | |
# disable for finding macos-problem | |
# https://github.com/svenstaro/upx-action | |
#- name: Compress binaries | |
# if: steps.extract_tag.outputs.tag != null | |
# uses: svenstaro/upx-action@v2 | |
# continue-on-error: false | |
# with: | |
# file: ./target/x86_64-apple-darwin/release/audiobookfinder | |
# args: --best | |
# strip: true | |
# | |
- name: Prepare install package | |
if: steps.extract_tag.outputs.tag != null | |
run: | | |
chmod a+x ./target/x86_64-apple-darwin/release/audiobookfinder | |
mkdir -p ./target/x86_64-apple-darwin/release/macosapp | |
cp ./target/x86_64-apple-darwin/release/audiobookfinder ./target/x86_64-apple-darwin/release/macosapp/audiobookfinder | |
cp README-release.md ./target/x86_64-apple-darwin/release/macosapp | |
cp LICENSE ./target/x86_64-apple-darwin/release/macosapp | |
# https://github.com/create-dmg/create-dmg | |
- name: Make install package | |
if: steps.extract_tag.outputs.tag != null | |
continue-on-error: true | |
run: >- | |
create-dmg | |
--volname "Adbf" | |
--volicon "docs/sheep.icns" | |
--background "docs/installer_background.png" | |
--window-pos 100 100 | |
--window-size 800 400 | |
--icon-size 100 | |
--icon "audiobookfinder.app" 50 50 | |
--eula "./target/x86_64-apple-darwin/release/macosapp/LICENSE" | |
--app-drop-link 600 185 | |
--hdiutil-verbose | |
"adbf-installer.dmg" | |
"./target/x86_64-apple-darwin/release/macosapp/" | |
# https://github.com/marketplace/actions/easy-zip-files | |
- name: zip files | |
if: steps.extract_tag.outputs.tag != null | |
uses: papeloto/action-zip@v1 | |
continue-on-error: false | |
with: | |
files: > | |
./target/x86_64-apple-darwin/release/audiobookfinder | |
./README-release.md | |
./LICENSE | |
recursive: false | |
dest: packaged | |
# ####################### upload intermediate result dependent if release in text or tagged | |
# https://github.com/marketplace/actions/upload-files-to-a-github-release | |
- name: Upload Release Asset - Zip | |
if: steps.extract_tag.outputs.tag != null | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: packaged | |
asset_name: audiobookfinder-x86_64-apple-darwin-${{ steps.extract_tag.outputs.tag }}.zip | |
tag: ${{ steps.extract_tag.outputs.tag }} | |
overwrite: true | |
- name: Upload Release Asset - dmg | |
continue-on-error: true | |
if: steps.extract_tag.outputs.tag != null | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: adbf-installer.dmg | |
asset_name: audiobookfinder-x86_64-apple-darwin-${{ steps.extract_tag.outputs.tag }}.dmg | |
tag: ${{ steps.extract_tag.outputs.tag }} | |
overwrite: true |