diff --git a/.github/pr.txt b/.github/pr.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/.github/workflows/nightly-docker.yml b/.github/workflows/nightly-docker.yml index 6205ca1cc..bdde18908 100644 --- a/.github/workflows/nightly-docker.yml +++ b/.github/workflows/nightly-docker.yml @@ -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: diff --git a/.github/workflows/sonar-scan.yml b/.github/workflows/sonar-scan.yml index 7bebc05a6..f17d7539b 100644 --- a/.github/workflows/sonar-scan.yml +++ b/.github/workflows/sonar-scan.yml @@ -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