From 14f500e8560a28177d6805349d846e0cafa219ae Mon Sep 17 00:00:00 2001 From: h1dden-da3m0n <33120068+h1dden-da3m0n@users.noreply.github.com> Date: Tue, 1 Jun 2021 21:26:59 +0200 Subject: [PATCH] overhaul workflows to be less complex and more reliable --- .github/workflows/build.yaml | 39 +++++++++++++++++++ .github/workflows/create-release-pr.yaml | 8 ++-- .github/workflows/on-pr-merge.yaml | 31 --------------- .../{build-publish.yaml => publish.yaml} | 29 +++++--------- .github/workflows/release-drafter.yaml | 6 +-- .github/workflows/test.yaml | 4 +- 6 files changed, 56 insertions(+), 61 deletions(-) create mode 100644 .github/workflows/build.yaml delete mode 100644 .github/workflows/on-pr-merge.yaml rename .github/workflows/{build-publish.yaml => publish.yaml} (81%) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 00000000..66f2e3d7 --- /dev/null +++ b/.github/workflows/build.yaml @@ -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 diff --git a/.github/workflows/create-release-pr.yaml b/.github/workflows/create-release-pr.yaml index 17d2266e..b9cb6938 100644 --- a/.github/workflows/create-release-pr.yaml +++ b/.github/workflows/create-release-pr.yaml @@ -13,14 +13,14 @@ jobs: uses: release-drafter/release-drafter@v5.15.0 id: draft env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }} - name: Setup YQ uses: chrisdickinson/setup-yq@latest with: yq-version: v4.9.1 - - name: Pars Changhelog + - name: Parse Changlog run: | cat << EOF >> cl.md ${{ steps.draft.outputs.body }} @@ -43,7 +43,7 @@ jobs: git config user.email "team@jellyfin.org" 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 git push origin prepare-${{ env.VERSION }} @@ -54,7 +54,7 @@ jobs: - name: Create or Update PR uses: k3rnels-actions/pr-update@v1 with: - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.JF_BOT_TOKEN }} pr_title: Prepare for release ${{ steps.draft.outputs.tag_name }} pr_source: prepare-${{ env.VERSION }} pr_labels: 'release-prep,skip-changelog' diff --git a/.github/workflows/on-pr-merge.yaml b/.github/workflows/on-pr-merge.yaml deleted file mode 100644 index acd4c6e3..00000000 --- a/.github/workflows/on-pr-merge.yaml +++ /dev/null @@ -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} diff --git a/.github/workflows/build-publish.yaml b/.github/workflows/publish.yaml similarity index 81% rename from .github/workflows/build-publish.yaml rename to .github/workflows/publish.yaml index 35252a3d..df5c2b38 100644 --- a/.github/workflows/build-publish.yaml +++ b/.github/workflows/publish.yaml @@ -1,19 +1,22 @@ -name: Build Jellyfin-Kodi +name: Publish Jellyfin-Kodi on: - push: - branches: - - master - tags: - - '*' + workflow_dispatch: jobs: - build: + publish: runs-on: ubuntu-latest strategy: matrix: py_version: [ 'py2', 'py3' ] 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 uses: actions/checkout@v2 @@ -38,18 +41,6 @@ jobs: path: | *.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 uses: burnett01/rsync-deployments@4.1 with: diff --git a/.github/workflows/release-drafter.yaml b/.github/workflows/release-drafter.yaml index 6e96ae70..9a451900 100644 --- a/.github/workflows/release-drafter.yaml +++ b/.github/workflows/release-drafter.yaml @@ -4,8 +4,6 @@ on: push: branches: - master - tags: - - '*' jobs: update_release_draft: @@ -14,7 +12,5 @@ jobs: steps: - name: Update Release Draft uses: release-drafter/release-drafter@v5.15.0 - with: - publish: ${{ startsWith(github.ref, 'refs/tags/') }} env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 4908d794..9701793c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -4,7 +4,7 @@ on: push: branches: - master - pull_request: + pull_request_target: branches: - master @@ -54,7 +54,7 @@ jobs: - name: Run reviewdog for PR checks-api if: ${{ env.PR_TRIGGERED == 'true' && matrix.py_version == '3.9' }} env: - REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.JF_BOT_TOKEN }} run: | cat flake8.output | reviewdog -reporter=github-pr-check -f=flake8 -name="flake8"