v1.6.7 #298
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
--- | |
name: Build | |
on: | |
push: | |
paths-ignore: | |
- '*.md' | |
jobs: | |
check_release: | |
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') | |
name: Check Release | |
runs-on: ubuntu-latest | |
outputs: | |
latest_release: ${{ steps.release_info.outputs.latest_release }} | |
current_version: ${{ steps.release_info.outputs.current_version }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Get Release Info | |
id: release_info | |
run: | | |
LATEST_RELEASE="$(curl -s https://api.github.com/repos/GeorgOhneH/ethz-document-fetcher/releases/latest | jq -r '.tag_name')" | |
CURRENT_VERSION="$(cat version.txt)" | |
echo "::set-output name=latest_release::$LATEST_RELEASE" | |
echo "::set-output name=current_version::$CURRENT_VERSION" | |
shell: sh | |
build: | |
needs: check_release | |
if: (needs.check_release.outputs.latest_release != needs.check_release.outputs.current_version) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-latest, macos-latest, ubuntu-latest] | |
fail-fast: false | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
architecture: 'x64' | |
- name: Upgrade pip | |
run: python -m pip install --upgrade pip | |
- name: Cache pip (Ubuntu) | |
uses: actions/cache@v2 | |
if: startsWith(runner.os, 'ubuntu') | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Cache pip (MacOS) | |
uses: actions/cache@v2 | |
if: startsWith(runner.os, 'macos') | |
with: | |
path: ~/Library/Caches/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Cache pip (Windows) | |
uses: actions/cache@v2 | |
if: startsWith(runner.os, 'windows') | |
with: | |
path: ~\AppData\Local\pip\Cache | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
pip install wheel -U | |
pip install -r requirements.txt -U | |
pip install boto3 -U | |
- name: Build Pyinstaller (Windows) | |
if: startsWith(matrix.os, 'windows') | |
shell: cmd | |
run: | | |
pip uninstall pyinstaller -y | |
git clone https://github.com/pyinstaller/pyinstaller.git | |
cd pyinstaller | |
git checkout tags/v4.2 | |
cd bootloader | |
python ./waf all | |
cd .. | |
python setup.py install | |
- name: Install dependencies (MacOS) | |
if: startsWith(matrix.os, 'macos') | |
run: | | |
pip install wheel -U | |
pip install dmgbuild -U | |
- name: Install dependencies (Ubuntu) | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install p7zip-full | |
sudo apt-get -y install -qq libegl1-mesa | |
- name: Init PyUpdater | |
run: python .CI/prepare_files.py | |
env: | |
PYU_AWS_ID: ${{ secrets.PYU_AWS_ID }} | |
PYU_AWS_SECRET: ${{ secrets.PYU_AWS_SECRET }} | |
- name: Build (Windows) | |
if: startsWith(matrix.os, 'windows') | |
shell: cmd | |
run: | | |
set /p VERSION=<version.txt | |
pyupdater build --app-version=%VERSION:~1% win.spec --pyinstaller-log-info | |
- name: Build (MacOS) | |
if: startsWith(matrix.os, 'macos') | |
run: | | |
VERSION="$(cat version.txt)" | |
pyupdater build --app-version=${VERSION:1} mac.spec --pyinstaller-log-info | |
- name: Build (Ubuntu) | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
VERSION="$(cat version.txt)" | |
pyupdater build --app-version=${VERSION:1} linux.spec --pyinstaller-log-info | |
- name: Unzip | |
run: python .CI/unzip.py | |
- name: Create patches | |
run: pyupdater pkg --process | |
- name: Cryptographically Sign | |
run: pyupdater pkg --sign --slit-version | |
- name: Upload Release (Windows) | |
if: startsWith(matrix.os, 'windows') | |
run: pyupdater upload --service s3 | |
env: | |
PYU_AWS_BUCKET: ethz-document-fetcher-win32 | |
PYU_AWS_BUCKET_REGION: eu-central-1 | |
PYU_AWS_ID: ${{ secrets.PYU_AWS_ID }} | |
PYU_AWS_SECRET: ${{ secrets.PYU_AWS_SECRET }} | |
- name: Upload Release (MacOS) | |
if: startsWith(matrix.os, 'macos') | |
run: pyupdater upload --service s3 | |
env: | |
PYU_AWS_BUCKET: ethz-document-fetcher-darwin | |
PYU_AWS_BUCKET_REGION: eu-central-1 | |
PYU_AWS_ID: ${{ secrets.PYU_AWS_ID }} | |
PYU_AWS_SECRET: ${{ secrets.PYU_AWS_SECRET }} | |
- name: Upload Release (Ubuntu) | |
if: startsWith(matrix.os, 'ubuntu') | |
run: pyupdater upload --service s3 | |
env: | |
PYU_AWS_BUCKET: ethz-document-fetcher-linux | |
PYU_AWS_BUCKET_REGION: eu-central-1 | |
PYU_AWS_ID: ${{ secrets.PYU_AWS_ID }} | |
PYU_AWS_SECRET: ${{ secrets.PYU_AWS_SECRET }} | |
- name: Upload PyUpdater Data | |
run: python .CI/upload_pyuppdate_data.py | |
env: | |
PYU_AWS_ID: ${{ secrets.PYU_AWS_ID }} | |
PYU_AWS_SECRET: ${{ secrets.PYU_AWS_SECRET }} | |
- name: Package (Windows) | |
if: startsWith(matrix.os, 'windows') | |
run: 7z a ethz-document-fetcher-windows-x86-64.zip ./distwin/ethz-document-fetcher/* | |
- name: Upload artifact (Windows) | |
if: startsWith(matrix.os, 'windows') | |
uses: actions/upload-artifact@v1 | |
with: | |
name: ethz-document-fetcher-windows-x86-64.zip | |
path: ethz-document-fetcher-windows-x86-64.zip | |
- name: Download ApplicationID plugin for NSIS (Windows) | |
if: startsWith(matrix.os, 'windows') | |
uses: carlosperate/[email protected] | |
with: | |
file-url: https://github.com/connectiblutz/NSIS-ApplicationID/releases/download/1.1/NSIS-ApplicationID.zip | |
file-name: applicationid_plugin.zip | |
location: ${{ github.workspace }}\NSIS_Plugins | |
- name: Extract ApplicationID plugin (Windows) | |
if: startsWith(matrix.os, 'windows') | |
run: | | |
cd .\NSIS_Plugins | |
7z x .\applicationid_plugin.zip | |
rename Release x86-ansi | |
rename ReleaseUnicode x86-unicode | |
shell: cmd | |
- name: Create installer (Windows) | |
if: startsWith(matrix.os, 'windows') | |
uses: joncloud/[email protected] | |
with: | |
script-file: "./.CI/windows_installer.nsi" | |
additional-plugin-paths: "./NSIS_Plugins/" | |
- name: Upload artifact (Windows) | |
if: startsWith(matrix.os, 'windows') | |
uses: actions/upload-artifact@v1 | |
with: | |
name: ethz-document-fetcher-windows-x86-64-installer.exe | |
path: ethz-document-fetcher-windows-x86-64-installer.exe | |
- name: Package (MacOS) | |
if: startsWith(matrix.os, 'macos') | |
run: | | |
dmgbuild --settings ./.CI/dmg-settings.py -D app=./distmac/ethz-document-fetcher.app ethz-document-fetcher ethz-document-fetcher-osx.dmg | |
- name: Upload artifact (MacOS) | |
if: startsWith(matrix.os, 'macos') | |
uses: actions/upload-artifact@v1 | |
with: | |
name: ethz-document-fetcher-osx.dmg | |
path: ethz-document-fetcher-osx.dmg | |
- name: Package (Ubuntu) | |
if: startsWith(matrix.os, 'ubuntu') | |
run: sh ./.CI/create_app_image.sh | |
shell: bash | |
- name: Upload artifact (Ubuntu) | |
if: startsWith(matrix.os, 'ubuntu') | |
uses: actions/upload-artifact@v1 | |
with: | |
name: ethz-document-fetcher-linux-x86_64.AppImage | |
path: ethz-document-fetcher-linux-x86_64.AppImage | |
create-release: | |
needs: [build, check_release] | |
runs-on: ubuntu-latest | |
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') | |
steps: | |
- name: Create release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ needs.check_release.outputs.current_version }} | |
release_name: Release ${{ needs.check_release.outputs.current_version }} | |
body: | |
draft: false | |
prerelease: false | |
- uses: actions/download-artifact@v1 | |
with: | |
name: ethz-document-fetcher-windows-x86-64.zip | |
path: windows/ | |
- uses: actions/download-artifact@v1 | |
with: | |
name: ethz-document-fetcher-windows-x86-64-installer.exe | |
path: windows/ | |
- uses: actions/download-artifact@v1 | |
with: | |
name: ethz-document-fetcher-linux-x86_64.AppImage | |
path: linux/ | |
- uses: actions/download-artifact@v1 | |
with: | |
name: ethz-document-fetcher-osx.dmg | |
path: macos/ | |
# - name: Read upload URL into output | |
# id: upload_url | |
# run: | | |
# echo "::set-output name=upload_url::$(cat release-upload-url.txt/release-upload-url.txt)" | |
- name: Upload release asset zip (Windows) | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./windows/ethz-document-fetcher-windows-x86-64.zip | |
asset_name: ethz-document-fetcher-windows-x86-64.zip | |
asset_content_type: application/zip | |
- name: Upload release asset exe (Windows) | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./windows/ethz-document-fetcher-windows-x86-64-installer.exe | |
asset_name: ethz-document-fetcher-windows-x86-64-installer.exe | |
asset_content_type: application/vnd.microsoft.portable-executable | |
- name: Upload release asset (Ubuntu) | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./linux/ethz-document-fetcher-linux-x86_64.AppImage | |
asset_name: ethz-document-fetcher-linux-x86_64.AppImage | |
asset_content_type: application/x-executable | |
- name: Upload release asset (MacOS) | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./macos/ethz-document-fetcher-osx.dmg | |
asset_name: ethz-document-fetcher-osx.dmg | |
asset_content_type: application/x-bzip2 |