Merge pull request #90 from paginagmbh/development #51
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
# note: list of awesome GitHub Actions: https://github.com/sdras/awesome-actions | |
name: Release pagina EPUB-Checker Apps | |
on: | |
push: | |
branches: | |
## live | |
- main | |
## debug | |
# - development | |
jobs: | |
release: | |
runs-on: macos-latest | |
env: | |
MAVEN_VERSIONS_PLUGIN: org.codehaus.mojo:versions-maven-plugin:2.7 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
lfs: false | |
fetch-depth: '0' | |
## live | |
ref: 'main' | |
## debug | |
# ref: 'development' | |
# - name: Checkout LFS objects | |
# run: git lfs checkout | |
- name: Import Code-Signing Certificates | |
uses: Apple-Actions/import-codesign-certs@v1 | |
with: | |
# The certificates in a PKCS12 file encoded as a base64 string created with "openssl base64 -in cert.p12 -out cert-base64.txt" | |
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }} | |
# The password used to import the PKCS12 file. | |
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }} | |
- name: Install gon via HomeBrew for code signing and app notarization | |
run: | | |
brew tap mitchellh/gon | |
brew install mitchellh/gon/gon | |
- name: Create gon config file | |
run: | | |
echo ${{ secrets.GON_DMG_CONFIG_BASE64 }} | base64 --decode > src/build/gon-dmg-config.json | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: '8' | |
- name: Set up GitHub Actions git user | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
- name: Cache Maven dependencies between builds | |
uses: actions/cache@v1 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Build the Java App and the native wrappers with Maven and codesign and notarize the Mac App | |
run: | | |
mvn -B ${MAVEN_VERSIONS_PLUGIN}:set -DremoveSnapshot=true -DgenerateBackupPoms=false | |
export MAVEN_PROJECT_VERSION=$(mvn help:evaluate -Dexpression="project.version" -q -DforceStdout) | |
mvn -B --show-version -Dmaven.skip.macSigning=false clean package | |
git commit -a -m "release version ${MAVEN_PROJECT_VERSION}" | |
git tag v${MAVEN_PROJECT_VERSION} | |
- name: Push changes at pom.xml to main | |
# 'github-push-action' does not work on 'macos-latest': https://github.com/ad-m/github-push-action/issues/51 | |
#uses: ad-m/[email protected] | |
#with: | |
# tags: true | |
# github_token: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git push "https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" HEAD:main --follow-tags --tags | |
- name: Increment maven project version on development branch | |
run: | | |
git fetch --prune | |
git checkout -f development | |
git merge --no-ff main | |
mvn -B ${MAVEN_VERSIONS_PLUGIN}:set -DnextSnapshot=true -DgenerateBackupPoms=false | |
git commit -a -m "prepare for next development iteration" | |
git push "https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" HEAD:development | |
- name: Archive build distributables | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Signed-Apps | |
path: | | |
target/EPUB-Checker.dmg | |
target/EPUB-Checker-*-dist-mac.zip | |
target/EPUB-Checker-*-dist-win.zip | |
target/EPUB-Checker-*-dist-linux.tar.gz | |
# TODO: Upload release-files to our primary download server | |
# https://github.com/marketplace/actions/scp-files |