Update build installer workflow with matrix

This commit is contained in:
JonnyWong16 2020-12-15 23:54:30 -08:00
parent 56244245a4
commit 7098930b19
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
2 changed files with 52 additions and 87 deletions

View file

@ -1,10 +1,13 @@
name: Publish Docker name: Publish Docker
on: on:
push: push:
branches: [master, beta, nightly, python3] branches: [master, beta, nightly]
tags: [v*] tags: [v*]
jobs: jobs:
build: build-docker:
name: Build Docker Image
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout Code - name: Checkout Code

View file

@ -1,12 +1,25 @@
name: Publish Release name: Publish Installers
on: on:
push: push:
branches: [master, beta, nightly, python3] branches: [master, beta, nightly]
tags: [v*] tags: [v*]
jobs: jobs:
build-windows: build-installer:
runs-on: windows-latest name: Build ${{ matrix.os_upper }} Installer
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
include:
- os: 'windows'
os_upper: 'Windows'
ext: 'exe'
- os: 'macos'
os_upper: 'MacOS'
ext: 'pkg'
steps: steps:
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -16,11 +29,13 @@ jobs:
shell: bash shell: bash
run: | run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then if [[ $GITHUB_REF == refs/tags/* ]]; then
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
VERSION_NSIS=${GITHUB_REF#refs/tags/v}.1 VERSION_NSIS=${GITHUB_REF#refs/tags/v}.1
echo ::set-output name=VERSION_NSIS::${VERSION_NSIS/%-beta.1/.0} echo ::set-output name=VERSION_NSIS::${VERSION_NSIS/%-beta.1/.0}
echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v} echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v}
echo ::set-output name=RELEASE_VERSION::${GITHUB_REF#refs/tags/} echo ::set-output name=RELEASE_VERSION::${GITHUB_REF#refs/tags/}
else else
echo "VERSION=0.0.0" >> $GITHUB_ENV
echo ::set-output name=VERSION_NSIS::0.0.0.0 echo ::set-output name=VERSION_NSIS::0.0.0.0
echo ::set-output name=VERSION::0.0.0 echo ::set-output name=VERSION::0.0.0
echo ::set-output name=RELEASE_VERSION::${GITHUB_SHA::7} echo ::set-output name=RELEASE_VERSION::${GITHUB_SHA::7}
@ -37,31 +52,44 @@ jobs:
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: ~\AppData\Local\pip\Cache path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-${{ hashFiles('package/requirements-windows.txt') }} key: ${{ runner.os }}-pip-${{ hashFiles(format('package/requirements-{0}.txt', matrix.os)) }}
restore-keys: ${{ runner.os }}-pip- restore-keys: ${{ runner.os }}-pip-
- name: Install Dependencies - name: Install Dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r package/requirements-windows.txt pip install -r package/requirements-${{ matrix.os }}.txt
- name: Build Package - name: Build Package
run: | run: |
pyinstaller -y ./package/Tautulli-windows.spec pyinstaller -y ./package/Tautulli-${{ matrix.os }}.spec
- name: Create Installer - name: Create Windows Installer
if: matrix.os == 'windows'
uses: joncloud/makensis-action@v1.2 uses: joncloud/makensis-action@v1.2
with: with:
script-file: ./package/Tautulli.nsi script-file: ./package/Tautulli.nsi
arguments: /DVERSION=${{ steps.get_version.outputs.VERSION_NSIS }} /DINSTALLER_NAME=..\Tautulli-windows-${{ steps.get_version.outputs.RELEASE_VERSION }}-x64.exe arguments: >
/DVERSION=${{ steps.get_version.outputs.VERSION_NSIS }}
/DINSTALLER_NAME=..\Tautulli-windows-${{ steps.get_version.outputs.RELEASE_VERSION }}-x64.exe
include-more-plugins: true include-more-plugins: true
include-custom-plugins-path: package/nsis-plugins include-custom-plugins-path: package/nsis-plugins
- name: Create MacOS Installer
if: matrix.os == 'macos'
run: |
sudo pkgbuild \
--install-location /Applications \
--version ${{ steps.get_version.outputs.VERSION }} \
--component ./dist/Tautulli.app \
--scripts ./package/macos-scripts \
Tautulli-macos-${{ steps.get_version.outputs.RELEASE_VERSION }}-x64.pkg
- name: Upload Installer - name: Upload Installer
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: Tautulli-windows-installer name: Tautulli-${{ matrix.os }}-installer
path: Tautulli-windows-${{ steps.get_version.outputs.RELEASE_VERSION }}-x64.exe path: Tautulli-${{ matrix.os }}-${{ steps.get_version.outputs.RELEASE_VERSION }}-x64.${{ matrix.ext }}
- name: Post Status to Discord - name: Post Status to Discord
uses: sarisia/actions-status-discord@v1 uses: sarisia/actions-status-discord@v1
@ -69,73 +97,12 @@ jobs:
with: with:
webhook: ${{ secrets.DISCORD_WEBHOOK }} webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ job.status }} status: ${{ job.status }}
title: Build Windows Installer title: Build ${{ matrix.os_upper }} Installer
nofail: true
build-macos:
runs-on: macos-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Set Release Version
id: get_version
shell: bash
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v}
echo ::set-output name=RELEASE_VERSION::${GITHUB_REF#refs/tags/}
else
echo "VERSION=0.0.0" >> $GITHUB_ENV
echo ::set-output name=VERSION::0.0.0
echo ::set-output name=RELEASE_VERSION::${GITHUB_SHA::7}
fi
echo $GITHUB_SHA > version.txt
- name: Set Up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Cache Dependencies
id: cache_dependencies
uses: actions/cache@v2
with:
path: ~/Library/Caches/pip
key: ${{ runner.os }}-pip-${{ hashFiles('package/requirements-macos.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r package/requirements-macos.txt
- name: Build Package
run: |
pyinstaller -y ./package/Tautulli-macos.spec
- name: Create Installer
run: |
sudo pkgbuild --install-location /Applications --version ${{ steps.get_version.outputs.VERSION }} --component ./dist/Tautulli.app --scripts ./package/macos-scripts Tautulli-macos-${{ steps.get_version.outputs.RELEASE_VERSION }}-x64.pkg
- name: Upload Installer
uses: actions/upload-artifact@v2
with:
name: Tautulli-macos-installer
path: Tautulli-macos-${{ steps.get_version.outputs.RELEASE_VERSION }}-x64.pkg
- name: Post Status to Discord
uses: sarisia/actions-status-discord@v1
if: always()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ job.status }}
title: Build MacOS Installer
nofail: true nofail: true
release: release:
needs: [build-windows, build-macos] name: Release Installers
needs: build-installer
if: startsWith(github.ref, 'refs/tags/') && always() if: startsWith(github.ref, 'refs/tags/') && always()
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -150,21 +117,16 @@ jobs:
run: | run: |
echo ::set-output name=RELEASE_VERSION::${GITHUB_REF#refs/tags/} echo ::set-output name=RELEASE_VERSION::${GITHUB_REF#refs/tags/}
- name: Download Windows Installer - name: Download Installers
if: env.WORKFLOW_CONCLUSION == 'success' if: env.WORKFLOW_CONCLUSION == 'success'
uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
with:
name: Tautulli-windows-installer
- name: Download MacOS Installer
if: env.WORKFLOW_CONCLUSION == 'success'
uses: actions/download-artifact@v2
with:
name: Tautulli-macos-installer
- name: Get Changelog - name: Get Changelog
id: get_changelog id: get_changelog
run: echo ::set-output name=CHANGELOG::"$( sed -n '/^## /{p; :loop n; p; /^## /q; b loop}' CHANGELOG.md | sed '$d' | sed '$d' | sed '$d' | sed ':a;N;$!ba;s/\n/%0A/g' )" run: |
changelog=$( sed -n '/^## /{p; :loop n; p; /^## /q; b loop}' CHANGELOG.md \
| sed '$d' | sed '$d' | sed '$d' | sed ':a;N;$!ba;s/\n/%0A/g' )
echo ::set-output name=CHANGELOG::$changelog
- name: Create Release - name: Create Release
id: create_release id: create_release