From 6a14d7733baefbe4b0e49ea8cc1903685387310f Mon Sep 17 00:00:00 2001 From: Cody Robibero Date: Sat, 6 Nov 2021 14:21:37 -0600 Subject: [PATCH] update ci --- .github/dependabot.yml | 2 +- .github/workflows/build-dotnet.yml | 5 +++- .github/workflows/codeql-analysis.yml | 3 +- .github/workflows/command-dispatch.yaml | 21 +++++++++++++ .github/workflows/command-rebase.yaml | 34 ++++++++++++++++++++++ .github/workflows/test-dotnet.yml | 3 +- .github/workflows/update-release-draft.yml | 22 ++++++++++---- 7 files changed, 81 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/command-dispatch.yaml create mode 100644 .github/workflows/command-rebase.yaml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 53f1fec..325dec4 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -23,7 +23,7 @@ updates: labels: - ci - dependency - - github-actions + - github_actions commit-message: prefix: ci include: scope diff --git a/.github/workflows/build-dotnet.yml b/.github/workflows/build-dotnet.yml index 279d3b5..ae8a851 100644 --- a/.github/workflows/build-dotnet.yml +++ b/.github/workflows/build-dotnet.yml @@ -19,11 +19,14 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: - dotnet-version: 5.0.x + dotnet-version: 6.0.x + include-prerelease: true - name: Build Jellyfin Plugin uses: oddstr13/jellyfin-plugin-repository-manager@v0.4.2 id: jprm + with: + dotnet-target: net6.0 - name: Upload Artifact uses: actions/upload-artifact@v2 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index cd143e6..e88927a 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -30,7 +30,8 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: - dotnet-version: 5.0.x + dotnet-version: 6.0.x + include-prerelease: true - name: Initialize CodeQL uses: github/codeql-action/init@v1 diff --git a/.github/workflows/command-dispatch.yaml b/.github/workflows/command-dispatch.yaml new file mode 100644 index 0000000..538de2b --- /dev/null +++ b/.github/workflows/command-dispatch.yaml @@ -0,0 +1,21 @@ +# Allows for the definition of PR and Issue /commands +name: Slash Command Dispatcher + +on: + issue_comment: + types: + - created + +jobs: + launcher: + runs-on: ubuntu-latest + steps: + - name: Command Dispatch + uses: peter-evans/slash-command-dispatch@v2 + with: + token: ${{ secrets.JF_BOT_TOKEN }} + permission: write + issue-type: pull-request + commands: |- + rebase + update-prep diff --git a/.github/workflows/command-rebase.yaml b/.github/workflows/command-rebase.yaml new file mode 100644 index 0000000..b2faf80 --- /dev/null +++ b/.github/workflows/command-rebase.yaml @@ -0,0 +1,34 @@ +name: PR Rebase Command + +on: + repository_dispatch: + types: + - rebase-command + +jobs: + rebase: + runs-on: ubuntu-latest + steps: + - name: Rebase PR + uses: peter-evans/rebase@v1 + id: rebase + with: + head: ${{ github.event.client_payload.pull_request.head.label }} + + - name: Add Success Reaction + if: ${{ steps.rebase.outputs.rebased-count == 1 }} + uses: peter-evans/create-or-update-comment@v1 + with: + token: ${{ secrets.JF_BOT_TOKEN }} + repository: ${{ github.event.client_payload.github.payload.repository.full_name }} + comment-id: ${{ github.event.client_payload.github.payload.comment.id }} + reaction-type: hooray + + - name: Add Failure Reaction + if: ${{ steps.rebase.outputs.rebased-count == 0 || failure() }} + uses: peter-evans/create-or-update-comment@v1 + with: + token: ${{ secrets.JF_BOT_TOKEN }} + repository: ${{ github.event.client_payload.github.payload.repository.full_name }} + comment-id: ${{ github.event.client_payload.github.payload.comment.id }} + reaction-type: confused, -1 diff --git a/.github/workflows/test-dotnet.yml b/.github/workflows/test-dotnet.yml index 05f2b13..a809342 100644 --- a/.github/workflows/test-dotnet.yml +++ b/.github/workflows/test-dotnet.yml @@ -19,7 +19,8 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: - dotnet-version: 5.0.x + dotnet-version: 6.0.x + include-prerelease: true - name: Install dependencies run: dotnet restore diff --git a/.github/workflows/update-release-draft.yml b/.github/workflows/update-release-draft.yml index c6a1f50..5cc9008 100644 --- a/.github/workflows/update-release-draft.yml +++ b/.github/workflows/update-release-draft.yml @@ -1,11 +1,16 @@ # Automates creation of Release Drafts using Release Drafter -name: Update Release Draft +name: Update Release Draft & Create Release Bump PR on: push: branches: - master + paths-ignore: + - build.yaml workflow_dispatch: + repository_dispatch: + types: + - update-prep-command jobs: update_release_draft: @@ -23,9 +28,9 @@ jobs: - name: Setup YQ uses: chrisdickinson/setup-yq@latest with: - yq-version: v4.9.6 + yq-version: v4.12.2 - - name: Parse changelog + - name: Set-up Environment run: | TAG="${{ steps.draft.outputs.tag_name }}" echo "VERSION=${TAG#v}" >> $GITHUB_ENV @@ -41,16 +46,22 @@ jobs: cat cl.md >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV + echo "HAS_CHANGES=$(grep -qie 'No changes$' cl.md && echo false || echo true)" >> $GITHUB_ENV rm cl.md - - name: Checkout repository + echo "ABI_VERSION=$(curl -s https://api.jellyfin.org/openapi/jellyfin-openapi-stable.json | jq -r '.info.version').0" >> $GITHUB_ENV + + - name: Checkout Repository + if: ${{ env.HAS_CHANGES == 'true' }} uses: actions/checkout@v2 - name: Update build.yaml + if: ${{ env.HAS_CHANGES == 'true' }} run: | - yq eval '.version = env(VERSION) | .changelog = strenv(CHANGELOG) | .changelog style="literal"' -i build.yaml + yq eval '.version = env(VERSION) | .targetAbi = env(ABI_VERSION) | .changelog = strenv(CHANGELOG) | .changelog style="literal"' -i build.yaml - name: Commit Changes + if: ${{ env.HAS_CHANGES == 'true' }} run: | git config user.name "jellyfin-bot" git config user.email "team@jellyfin.org" @@ -59,6 +70,7 @@ jobs: git push -f origin prepare-${{ env.VERSION }} - name: Create or Update PR + if: ${{ env.HAS_CHANGES == 'true' }} uses: k3rnels-actions/pr-update@v1 with: token: ${{ secrets.JF_BOT_TOKEN }}