Skip to content

Commit

Permalink
Merge pull request #90 from paginagmbh/development
Browse files Browse the repository at this point in the history
Release 2.0.10
  • Loading branch information
Kamik423 authored Aug 28, 2023
2 parents 0723720 + 09fadca commit 9a67320
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 64 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/maven-test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ name: Maven test, build and verify
on:
push:
branches-ignore:
- master
- main
pull_request:
branches-ignore:
- master
- main

jobs:
build:
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ on:
push:
branches:
## live
- master
- main
## debug
- development
# - development

jobs:
release:
Expand All @@ -21,9 +21,9 @@ jobs:
lfs: false
fetch-depth: '0'
## live
#ref: 'master'
ref: 'main'
## debug
ref: 'development'
# ref: 'development'
# - name: Checkout LFS objects
# run: git lfs checkout

Expand Down Expand Up @@ -70,20 +70,20 @@ jobs:
git commit -a -m "release version ${MAVEN_PROJECT_VERSION}"
git tag v${MAVEN_PROJECT_VERSION}
- name: Push changes at pom.xml to master
- 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/github-push-action@v0.5.0
#with:
# tags: true
# github_token: ${{ secrets.GITHUB_TOKEN }}
run: |
git push "https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" HEAD:master --follow-tags --tags
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 master
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
Expand Down
67 changes: 12 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pagina EPUB-Checker

![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/paginagmbh/EPUB-Checker/maven-test-build.yml?label=Maven%20CI%20Tests) ![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/paginagmbh/EPUB-Checker/release.yml?label=Release%20CI)

Standalone "EPUBCheck" application for Windows, macOS and Linux.
Standalone EPUBCheck application for Windows, macOS and Linux.

With the pagina EPUB-Checker one can easily validate eBooks in the EPUB format. The test mechanisms of the EPUB-Checker are based on the official open-source [EPUBCheck](https://github.com/w3c/epubcheck) EPUB validator.

Expand All @@ -15,7 +15,7 @@ pagina EPUB-Checker wraps up this tool and offers some additional features like:

* Graphical user interface
* Drag & drop EPUB to validate
* Ability to validate expanded (unzipped) EPUB's
* Ability to validate expanded (unzipped) EPUBs
* Expanded folders are automatically zipped up to an EPUB file upon validation
* The generated EPUB file will be saved if it is valid
* Localized GUI and errors and warnings:
Expand All @@ -39,9 +39,9 @@ pagina EPUB-Checker doesn't need to be installed and therefore works on portable
Download
--------

Please visit our website https://www.pagina.gmbh/produkte/epub-checker/ to download the Windows _EXE_ file, the Mac _App_ or the Linux _JAR_.
Please visit our website https://www.pagina.gmbh/produkte/epub-checker/ to download the Windows *.exe* file, the Mac *.app* or the Linux *.jar*.

This is just the source code repository. You won't find any pre-build binaries here...
This is just the source code repository. You wont find any pre-build binaries here...


License information
Expand All @@ -67,7 +67,7 @@ Build the app

In order to build the Linux JAR, the Mac App and the Windows EXE files you just have to run

```
```sh
mvn clean package
```

Expand All @@ -85,7 +85,7 @@ This will build the executables but skip the macOS specific codesigning process
Release the app
---------------

Releasing a new version requires the Mac App to be codesigned and notarized. This can be done from the maven packaging process or via GitHub Actions CI on the `master` branch. The additional maven step will run a bash script (`src/build/mac-release.sh`) to codesign and notarize the Mac App with our private Apple Developer Certificate. Therefore, this step will only work on our systems or in GitHub Actions CI.
Releasing a new version requires the Mac App to be codesigned and notarized. This can be done from the maven packaging process or via GitHub Actions CI on the `main` branch. The additional maven step will run a bash script (`src/build/mac-release.sh`) to codesign and notarize the Mac App with our private Apple Developer Certificate. Therefore, this step will only work on our systems or in GitHub Actions CI.

### Release requirements

Expand All @@ -101,69 +101,26 @@ Codesigning is done with the default macOS `codesign` utility

*App notarization*

App notarization is done with [gon](https://github.com/mitchellh/gon), an excellent utility for this job. It will be installed via HomeBrew if it's missing.
App notarization is done with [gon](https://github.com/mitchellh/gon), an excellent utility for this job. It will be installed via HomeBrew if its missing.

To be able to submit the App for notarization, you need to copy `src/build/gon-dmg-config.template.json` to `src/build/gon-dmg-config.json` and fill the `apple_id` credentials.

*DiskImage creation*

DiskImage creation is done with the NodeJS utility [electron-installer-dmg](https://github.com/electron-userland/electron-installer-dmg). It will be installed via NPM if it's missing.
DiskImage creation is done with the NodeJS utility [electron-installer-dmg](https://github.com/electron-userland/electron-installer-dmg). It will be installed via NPM if its missing.

### Build the release locally

To build the JAR's, the Windows EXE and Mac App and to run the Mac App codesigning and notarization process for distribution _locally,_ you have to enable the _skipped-by-default_ maven task with:
To build the *.jar*s, the Windows *.exe* and Mac *.app* and to run the Mac-App codesigning and notarization process for distribution _locally,_ you have to enable the *skipped-by-default* maven task with:

```
```sh
mvn -Dmaven.skip.macSigning=false clean package
```

With changes to how the generated .jar file is structured internally, and how Apple handles the files for the notarization, at the moment some manual steps are required to arrive at a notarized version of the application. <br/>

**Problem**

The problem is that inside the generated .jar file, there is a naming conflict, but only on case-insensitive Mac-based file systems, which seems to be the case for the notarization runners. Inside the generated .jar file, the process generates a file `LICENSE` (uppercase), which conflicts with a folder `license` (lowercase). The extraction of the .jar fails due to a file conflict during extraction of the .jar file, since first the folder is extracted, which can not be overwritten by the file, which is extracted later.

**Solution**
The future naming conflict needs to be resolved, before it can come into effect. In order to achieve this, the build process needs to be stopped before the application is uploaded to the notarization service and modified and before the .dmg archive is built. Since the .dmg is built from the .app, the future naming conflict needs to be dealt with inside the .app. In order to resolve the issue, open the file `paginaEPUBChecker.jar` inside `target/EPUB-Checker.app/Contents/Resources/Java` in Oxygen or any other program capable of renaming files inside .zip/.jar files. Then rename either the file `LICENSE` to e.g. `LICENSE.txt`, or the `license` folder to e.g. `license_dir` and overwrite the existing .jar file. Then build the .dmg file from the modified .app directory with

```
electron-installer-dmg \
--title="pagina EPUB-Checker X.Y.Z" \
--out=target \
--icon=src/build/icons/paginaEPUBChecker_128.icns \
--background=src/build/splashscreen/DmgBackground.png \
--overwrite \
target/EPUB-Checker.app \
EPUB-Checker
```

Then, codesign the .dmg archive (replace "${APPLE_SIGN_ID}" with the actual ID).

```
/usr/bin/codesign --force --verbose --options runtime --sign "${APPLE_SIGN_ID}" target/EPUB-Checker.dmg
/usr/bin/codesign --verify --strict --deep --verbose target/EPUB-Checker.dmg
```

In the next step, upload the .dmg file to the Apple notarization service with

```
gon -log-level=info -log-json src/build/gon-dmg-config.json
```

Then ensure that the codesigning and subsequent notarization actions worked by running the following commands:

```
/usr/bin/xcrun stapler validate target/EPUB-Checker.dmg
/usr/sbin/spctl -a -t install -vv target/EPUB-Checker.dmg
/usr/bin/xcrun stapler staple target/EPUB-Checker.app
/usr/bin/xcrun stapler validate target/EPUB-Checker.app
```
With changes to how the generated *.jar* file is structured internally, and how Apple handles the files for the notarization, at the moment some manual steps are required to arrive at a notarized version of the application.

### Build & release with GitHub Actions

**Update (05/2023)**: at the moment, the release mechanism temporarily only works when started **locally** (cf. above), due to changes in how Apple handles the files to be notarized. The procedure described below will work again, once the steps that are described above will have been automatized - which is definitely within the realm of possibilities.

To build and release with GitHub Actions CI, just merge a _snapshot version_ from `development` to `master`. No need to upgrade the Maven version first or to set a git tag. Just merge to `master` and CI is doing all the hard work (as defined in `.github/workflows/release.yml`).
To build and release with GitHub Actions CI, just merge a _snapshot version_ from `development` to `main`. No need to upgrade the Maven version first or to set a git tag. Just merge to `main` and CI is doing all the hard work (as defined in `.github/workflows/release.yml`).

The release distributables are attached to the GitHub Actions build as build artifacts and can be used for distribution on our download server.

0 comments on commit 9a67320

Please sign in to comment.