Skip to content

fix

fix #303

Workflow file for this run

---
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: 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
sudo apt-get -y install fuse libfuse2
- name: Build (Windows)
if: startsWith(matrix.os, 'windows')
shell: cmd
run: |
pyinstaller win.spec
- name: Build (MacOS)
if: startsWith(matrix.os, 'macos')
run: |
pyinstaller mac.spec
- name: Build (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: |
pyinstaller linux.spec
- name: Package (Windows)
if: startsWith(matrix.os, 'windows')
run: 7z a ethz-document-fetcher-windows-x86-64.zip ./dist/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=./dist/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