Updating discord action (#494)

* Updating docker action

* adding version to message

* adding way to get PR title and body

* Adding input pass to workflows

Workflow dispatches may not get push header info. Switching logic to pass needed title and body info through just in case.

* adding token

The description on this action is awful, it didn't mention needing a token. I found this solution from the repo's issues

* parsing pr body

* Updating parsing

* Updating docker workflow

* Reverting back to default variables

* fixing syntax error

* removing heading syntax

* updating parse

* Updating parsing

* Updating docker workflow

* trying to remove newline

* updating parsing

* Replacement in parsing

* Update sonar-scan.yml

* testing passing pr body via artifact

* Updating action version

* syntax fix

* Updating write

* Updating write

* testing artifact

* consolidating nightly-docker into main workflow
This commit is contained in:
Robbie Davis 2021-08-12 15:38:56 -04:00 committed by GitHub
parent ccd37b1d70
commit 95aba3d957
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 81 additions and 35 deletions

0
.github/pr.txt vendored
View File

View File

@ -19,29 +19,6 @@ jobs:
with:
ref: develop
- name: Download PR Body
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: sonar-scan.yml
path: .github/
- name: Get PR body
uses: pCYSl5EDgo/cat@master
id: prbody
with:
path: .github/pr.txt
- name: Parse PR body
run: |
body='${{ steps.findPr.outputs.body }}'
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo $body
echo "::set-output name=BODY::$body"
id: parse-body
- name: NodeJS to Compile WebUI
uses: actions/setup-node@v2.1.5
with:

View File

@ -121,35 +121,104 @@ jobs:
github_token: ${{ secrets.REPO_GHA_PAT }}
develop:
name: Trigger Nightly Docker if Develop push
name: Build Nightly Docker if Develop push
needs: [ build, test, version ]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' }}
steps:
- name: Find Current Pull Request
uses: jwalton/gh-find-current-pr@v1.0.2
id: findPr
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Write PR Body
- name: Parse PR body
id: parse-body
run: |
echo "${{ steps.findPr.outputs.body }}" >> .github/pr.txt
id: parse-body
body='${{ steps.findPr.outputs.body }}'
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo $body
echo "::set-output name=BODY::$body"
- name: Upload PR Body as Artifact
uses: actions/upload-artifact@v2
- name: Check Out Repo
uses: actions/checkout@v2
with:
name: prbody
path: .github/pr.txt
ref: develop
- name: If Push to Develop, Trigger Docker Stable
- name: NodeJS to Compile WebUI
uses: actions/setup-node@v2.1.5
with:
node-version: '14'
- run: |
cd UI/Web || exit
echo 'Installing web dependencies'
npm install
echo 'Building UI'
npm run prod
echo 'Copying back to Kavita wwwroot'
rsync -a dist/ ../../API/wwwroot/
cd ../ || exit
- name: Get csproj Version
uses: naminodarie/get-net-sdk-project-versions-action@v1
id: get-version
with:
proj-path: Kavita.Common/Kavita.Common.csproj
- name: Echo csproj version
run: echo "${{steps.get-version.outputs.assembly-version}}"
- name: Compile dotnet app
uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.x'
- run: ./monorepo-build.sh
- name: Trigger Sentry workflow
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Build Nightly Docker
workflow: Sentry Map Release
token: ${{ secrets.REPO_GHA_PAT }}
inputs: '{ "title": "${{ steps.findPr.outputs.title }}" }'
inputs: '{ "version": "${{steps.get-version.outputs.assembly-version}}" }'
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
tags: kizaing/kavita:nightly
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
- name: Notify Discord
uses: rjstone/discord-webhook-notify@v1
with:
severity: info
description: v${{steps.get-version.outputs.assembly-version}} - ${{ github.event.inputs.title }}
details: '${{ steps.parse-body.outputs.BODY }}'
text: A new nightly build has been released for docker.
webhookUrl: ${{ secrets.DISCORD_DOCKER_UPDATE_URL }}
stable:
name: Trigger Stable Docker if Main push