195 lines
6.8 KiB
YAML
195 lines
6.8 KiB
YAML
name: Publish Installers
|
|
|
|
on:
|
|
push:
|
|
branches: [master, beta, nightly]
|
|
tags: [v*]
|
|
pull_request: ~
|
|
|
|
jobs:
|
|
build-installer:
|
|
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:
|
|
- 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
|
|
VERSION_NSIS=${GITHUB_REF#refs/tags/v}.1
|
|
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=RELEASE_VERSION::${GITHUB_REF#refs/tags/}
|
|
else
|
|
echo "VERSION=0.0.0" >> $GITHUB_ENV
|
|
echo ::set-output name=VERSION_NSIS::0.0.0.0
|
|
echo ::set-output name=VERSION::0.0.0
|
|
echo ::set-output name=RELEASE_VERSION::${GITHUB_SHA::7}
|
|
fi
|
|
if [[ $GITHUB_REF == refs/tags/*-beta ]]; then
|
|
echo "beta" > branch.txt
|
|
elif [[ $GITHUB_REF == refs/tags/* ]]; then
|
|
echo "master" > branch.txt
|
|
else
|
|
echo ${GITHUB_REF#refs/heads/} > branch.txt
|
|
fi
|
|
echo $GITHUB_SHA > version.txt
|
|
|
|
- name: Set Up Python
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: 3.8
|
|
|
|
- name: Cache Dependencies
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ~\AppData\Local\pip\Cache
|
|
key: ${{ runner.os }}-pip-${{ hashFiles(format('package/requirements-{0}.txt', matrix.os)) }}
|
|
restore-keys: ${{ runner.os }}-pip-
|
|
|
|
- name: Install Dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r package/requirements-${{ matrix.os }}.txt
|
|
|
|
- name: Build Package
|
|
run: |
|
|
pyinstaller -y ./package/Tautulli-${{ matrix.os }}.spec
|
|
|
|
- name: Move Windows Updater Files
|
|
if: matrix.os == 'windows'
|
|
run: |
|
|
Move-Item dist\updater\* dist\Tautulli\ -Force
|
|
|
|
- name: Create Windows Installer
|
|
uses: joncloud/makensis-action@v3.4
|
|
if: matrix.os == 'windows'
|
|
with:
|
|
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
|
|
additional-plugin-paths: 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
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: Tautulli-${{ matrix.os }}-installer
|
|
path: Tautulli-${{ matrix.os }}-${{ steps.get_version.outputs.RELEASE_VERSION }}-x64.${{ matrix.ext }}
|
|
|
|
release:
|
|
name: Release Installers
|
|
needs: build-installer
|
|
if: always() && startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Get Build Job Status
|
|
uses: technote-space/workflow-conclusion-action@v1
|
|
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set Release Version
|
|
id: get_version
|
|
run: |
|
|
echo ::set-output name=RELEASE_VERSION::${GITHUB_REF#refs/tags/}
|
|
|
|
- name: Download Installers
|
|
if: env.WORKFLOW_CONCLUSION == 'success'
|
|
uses: actions/download-artifact@v2
|
|
|
|
- name: 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' )"
|
|
|
|
- name: Create Release
|
|
uses: actions/create-release@v1
|
|
id: create_release
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ steps.get_version.outputs.RELEASE_VERSION }}
|
|
release_name: Tautulli ${{ steps.get_version.outputs.RELEASE_VERSION }}
|
|
body: |
|
|
## Changelog
|
|
|
|
##${{ steps.get_changelog.outputs.CHANGELOG }}
|
|
draft: false
|
|
prerelease: ${{ endsWith(steps.get_version.outputs.RELEASE_VERSION, '-beta') }}
|
|
|
|
- name: Upload Windows Installer
|
|
uses: actions/upload-release-asset@v1
|
|
if: env.WORKFLOW_CONCLUSION == 'success'
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: Tautulli-windows-installer/Tautulli-windows-${{ steps.get_version.outputs.RELEASE_VERSION }}-x64.exe
|
|
asset_name: Tautulli-windows-${{ steps.get_version.outputs.RELEASE_VERSION }}-x64.exe
|
|
asset_content_type: application/vnd.microsoft.portable-executable
|
|
|
|
- name: Upload MacOS Installer
|
|
uses: actions/upload-release-asset@v1
|
|
if: env.WORKFLOW_CONCLUSION == 'success'
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: Tautulli-macos-installer/Tautulli-macos-${{ steps.get_version.outputs.RELEASE_VERSION }}-x64.pkg
|
|
asset_name: Tautulli-macos-${{ steps.get_version.outputs.RELEASE_VERSION }}-x64.pkg
|
|
asset_content_type: application/vnd.apple.installer+xml
|
|
|
|
discord:
|
|
name: Discord Notification
|
|
needs: [build-installer, release]
|
|
if: always() && github.event_name != 'pull_request'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Get Build Job Status
|
|
uses: technote-space/workflow-conclusion-action@v1
|
|
|
|
- name: Combine Job Status
|
|
id: status
|
|
run: |
|
|
failures=(neutral, skipped, timed_out, action_required)
|
|
if [[ ${array[@]} =~ $WORKFLOW_CONCLUSION ]]; then
|
|
echo ::set-output name=status::failure
|
|
else
|
|
echo ::set-output name=status::$WORKFLOW_CONCLUSION
|
|
fi
|
|
|
|
- name: Post Status to Discord
|
|
uses: sarisia/actions-status-discord@v1
|
|
with:
|
|
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
|
status: ${{ steps.status.outputs.status }}
|
|
title: ${{ github.workflow }}
|
|
nofail: true
|