overhaul workflows to be less complex and more reliable

This commit is contained in:
h1dden-da3m0n 2021-06-01 21:26:59 +02:00
parent 1526e0be54
commit 14f500e856
6 changed files with 56 additions and 61 deletions

39
.github/workflows/build.yaml vendored Normal file
View file

@ -0,0 +1,39 @@
name: Build Jellyfin-Kodi
on:
push:
branches:
- master
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
py_version: [ 'py2', 'py3' ]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pyyaml
- name: Create ${{ matrix.py_version }} addon.xml
run: python .build/build.py --version ${{ matrix.py_version }} --source . --target .
- name: Publish Build Artifact
uses: actions/upload-artifact@v2
with:
retention-days: 14
name: ${{ matrix.py_version }}-build-artifact
path: |
*.zip

View file

@ -13,14 +13,14 @@ jobs:
uses: release-drafter/release-drafter@v5.15.0 uses: release-drafter/release-drafter@v5.15.0
id: draft id: draft
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }}
- name: Setup YQ - name: Setup YQ
uses: chrisdickinson/setup-yq@latest uses: chrisdickinson/setup-yq@latest
with: with:
yq-version: v4.9.1 yq-version: v4.9.1
- name: Pars Changhelog - name: Parse Changlog
run: | run: |
cat << EOF >> cl.md cat << EOF >> cl.md
${{ steps.draft.outputs.body }} ${{ steps.draft.outputs.body }}
@ -43,7 +43,7 @@ jobs:
git config user.email "team@jellyfin.org" git config user.email "team@jellyfin.org"
git checkout -b prepare-${{ env.VERSION }} git checkout -b prepare-${{ env.VERSION }}
git commit -am "bump version" git commit -am "bump version to ${{ env.VERSION }}"
if [[ -z "$(git ls-remote --heads origin prepare-${{ env.VERSION }})" ]]; then if [[ -z "$(git ls-remote --heads origin prepare-${{ env.VERSION }})" ]]; then
git push origin prepare-${{ env.VERSION }} git push origin prepare-${{ env.VERSION }}
@ -54,7 +54,7 @@ jobs:
- name: Create or Update PR - name: Create or Update PR
uses: k3rnels-actions/pr-update@v1 uses: k3rnels-actions/pr-update@v1
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.JF_BOT_TOKEN }}
pr_title: Prepare for release ${{ steps.draft.outputs.tag_name }} pr_title: Prepare for release ${{ steps.draft.outputs.tag_name }}
pr_source: prepare-${{ env.VERSION }} pr_source: prepare-${{ env.VERSION }}
pr_labels: 'release-prep,skip-changelog' pr_labels: 'release-prep,skip-changelog'

View file

@ -1,31 +0,0 @@
name: On PR Merge
on:
pull_request_target:
branches:
- master
types:
- closed
jobs:
trigger_release:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'release-prep') }}
steps:
- name: Setup YQ
uses: chrisdickinson/setup-yq@latest
with:
yq-version: v4.9.1
- name: Checkout repository
uses: actions/checkout@v2
- name: Create Tag
run: |
git config user.name "jellyfin-bot"
git config user.email "team@jellyfin.org"
VERSION="$(yq e -M '.version' release.yaml)"
git tag v${VERSION}
git push origin v${VERSION}

View file

@ -1,19 +1,22 @@
name: Build Jellyfin-Kodi name: Publish Jellyfin-Kodi
on: on:
push: workflow_dispatch:
branches:
- master
tags:
- '*'
jobs: jobs:
build: publish:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
py_version: [ 'py2', 'py3' ] py_version: [ 'py2', 'py3' ]
steps: steps:
- name: Update Draft
uses: release-drafter/release-drafter@v5.15.0
with:
publish: true
env:
GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }}
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -38,18 +41,6 @@ jobs:
path: | path: |
*.zip *.zip
publish:
runs-on: ubuntu-latest
needs: build
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository == 'jellyfin/jellyfin-kodi' }}
strategy:
matrix:
py_version: [ 'py2', 'py3' ]
steps:
- uses: actions/download-artifact@v2
with:
name: ${{ matrix.py_version }}-build-artifact
- name: Upload to repo server - name: Upload to repo server
uses: burnett01/rsync-deployments@4.1 uses: burnett01/rsync-deployments@4.1
with: with:

View file

@ -4,8 +4,6 @@ on:
push: push:
branches: branches:
- master - master
tags:
- '*'
jobs: jobs:
update_release_draft: update_release_draft:
@ -14,7 +12,5 @@ jobs:
steps: steps:
- name: Update Release Draft - name: Update Release Draft
uses: release-drafter/release-drafter@v5.15.0 uses: release-drafter/release-drafter@v5.15.0
with:
publish: ${{ startsWith(github.ref, 'refs/tags/') }}
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }}

View file

@ -4,7 +4,7 @@ on:
push: push:
branches: branches:
- master - master
pull_request: pull_request_target:
branches: branches:
- master - master
@ -54,7 +54,7 @@ jobs:
- name: Run reviewdog for PR checks-api - name: Run reviewdog for PR checks-api
if: ${{ env.PR_TRIGGERED == 'true' && matrix.py_version == '3.9' }} if: ${{ env.PR_TRIGGERED == 'true' && matrix.py_version == '3.9' }}
env: env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.JF_BOT_TOKEN }}
run: | run: |
cat flake8.output | reviewdog -reporter=github-pr-check -f=flake8 -name="flake8" cat flake8.output | reviewdog -reporter=github-pr-check -f=flake8 -name="flake8"