Nightly Workflow #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Nightly Workflow | |
on: | |
push: | |
branches: [ 'develop', '!release/**' ] | |
workflow_dispatch: | |
jobs: | |
debug: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Debug Info | |
run: | | |
echo "Event Name: ${{ github.event_name }}" | |
echo "Ref: ${{ github.ref }}" | |
echo "Not Contains Release: ${{ !contains(github.head_ref, 'release') }}" | |
echo "Matches Develop: ${{ github.ref == 'refs/heads/develop' }}" | |
build: | |
name: Upload Kavita.Common for Version Bump | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/develop' | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: csproj | |
path: Kavita.Common/Kavita.Common.csproj | |
version: | |
name: Bump version | |
needs: [ build ] | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/develop' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Bump versions | |
uses: majora2007/[email protected] | |
with: | |
version_files: Kavita.Common/Kavita.Common.csproj | |
github_token: ${{ secrets.REPO_GHA_PAT }} | |
version_mask: "0.0.0.1" | |
develop: | |
name: Build Nightly Docker | |
needs: [ build, version ] | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/develop' | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- name: Find Current Pull Request | |
uses: jwalton/gh-find-current-pr@v1 | |
with: | |
state: all | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Parse PR body | |
id: parse-body | |
run: | | |
body="${{ steps.findPr.outputs.body }}" | |
if [[ ${#body} -gt 1870 ]] ; then | |
body=${body:0:1870} | |
body="${body}...and much more. | |
Read full changelog: https://github.com/Kareadita/Kavita/pull/${{ steps.findPr.outputs.pr }}" | |
fi | |
body=${body//\'/} | |
body=${body//'%'/'%25'} | |
body=${body//$'\n'/'%0A'} | |
body=${body//$'\r'/'%0D'} | |
body=${body//$'`'/'%60'} | |
body=${body//$'>'/'%3E'} | |
echo $body | |
echo "BODY=$body" >> $GITHUB_OUTPUT | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
with: | |
ref: develop | |
- name: NodeJS to Compile WebUI | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- run: | | |
cd UI/Web || exit | |
echo 'Installing web dependencies' | |
npm install --legacy-peer-deps | |
echo 'Building UI' | |
npm run prod | |
echo 'Copying back to Kavita wwwroot' | |
rsync -a dist/ ../../API/wwwroot/ | |
cd ../ || exit | |
- name: Get csproj Version | |
uses: kzrnm/get-net-sdk-project-versions-action@v2 | |
id: get-version | |
with: | |
proj-path: Kavita.Common/Kavita.Common.csproj | |
- name: Parse Version | |
run: | | |
version='${{steps.get-version.outputs.assembly-version}}' | |
echo "VERSION=$version" >> $GITHUB_OUTPUT | |
id: parse-version | |
- name: Echo csproj version | |
run: echo "${{steps.get-version.outputs.assembly-version}}" | |
- name: Compile dotnet app | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Install Swashbuckle CLI | |
run: dotnet tool install -g --version 6.5.0 Swashbuckle.AspNetCore.Cli | |
build-and-package: | |
name: Build and Package | |
needs: [develop] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '3.1.x' | |
- name: Restore and Build | |
run: | | |
dotnet clean Kavita.sln -c Release | |
dotnet msbuild -restore Kavita.sln -p:Configuration=Release -p:Platform="Any CPU" -p:RuntimeIdentifiers=linux-x64 | |
dotnet msbuild -restore Kavita.sln -p:Configuration=Release -p:Platform="Any CPU" -p:RuntimeIdentifiers=linux-arm | |
dotnet msbuild -restore Kavita.sln -p:Configuration=Release -p:Platform="Any CPU" -p:RuntimeIdentifiers=linux-arm64 | |
- name: Package Linux x64 | |
run: | | |
cd API | |
dotnet publish -c Release --no-restore --self-contained --runtime linux-x64 -o ../_output/linux-x64/Kavita | |
mv ../_output/linux-x64/Kavita/API ../_output/linux-x64/Kavita | |
cp -r wwwroot/* ../_output/linux-x64/Kavita/wwwroot/ | |
cp INSTALL.txt ../_output/linux-x64/Kavita/README.txt | |
cp ../LICENSE ../_output/linux-x64/Kavita/LICENSE.txt | |
cp ./config/appsettings.Development.json ../_output/linux-x64/Kavita/config/appsettings.json | |
cd ../_output/linux-x64/ | |
tar -czvf ../kavita-linux-x64.tar.gz Kavita | |
- name: Package Linux ARM | |
run: | | |
cd API | |
dotnet publish -c Release --no-restore --self-contained --runtime linux-arm -o ../_output/linux-arm/Kavita | |
mv ../_output/linux-arm/Kavita/API ../_output/linux-arm/Kavita | |
cp -r wwwroot/* ../_output /linux-arm/Kavita/wwwroot/ | |
cp INSTALL.txt ../_output/linux-arm/Kavita/README.txt | |
cp ../LICENSE ../_output/linux-arm/Kavita/LICENSE.txt | |
cp ./config/appsettings.Development.json ../_output/linux-arm/Kavita/config/appsettings.json | |
cd ../_output/linux-arm/ | |
tar -czvf ../kavita-linux-arm.tar.gz Kavita | |
- name: Package Linux ARM64 | |
run: | | |
cd API | |
dotnet publish -c Release --no-restore --self-contained --runtime linux-arm64 -o ../_output/linux-arm64/Kavita | |
mv ../_output/linux-arm64/Kavita/API ../_output/linux-arm64/Kavita | |
cp -r wwwroot/* ../_output/linux-arm64/Kavita/wwwroot/ | |
cp INSTALL.txt ../_output/linux-arm64/Kavita/README.txt | |
cp ../LICENSE ../_output/linux-arm64/Kavita/LICENSE.txt | |
cp ./config/appsettings.Development.json ../_output/linux-arm64/Kavita/config/appsettings.json | |
cd ../_output/linux-arm64/ | |
tar -czvf ../kavita-linux-arm64.tar.gz Kavita |