Update develop-workflow.yml #11
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: | |
pull_request: | |
branches: [ develop ] | |
env: | |
DOTNET_VERSION: '8.0.x' | |
jobs: | |
bump: | |
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: [ bump ] | |
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: ${{ env.DOTNET_VERSION }} | |
- 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 | |
needs: [ bump, 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 | |
id: findPr | |
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: Setup Node.js environment | |
uses: actions/[email protected] | |
with: | |
node-version: 20 | |
node-version-file: UI/Web/package.json | |
cache: 'npm' | |
cache-dependency-path: UI/Web/package-lock.json | |
- run: | | |
cd UI/Web | |
npm ci | |
- run: | | |
cd UI/Web/ | |
npm run prod | |
- run: | | |
cd UI/Web | |
rsync -a dist/ ../../API/wwwroot/ | |
- 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}}" | |
compile: | |
name: build-and-test-${{matrix.os}} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- uses: actions/[email protected] | |
with: | |
path: ~/.nuget/packages | |
# Look to see if there is a cache hit for the corresponding requirements file | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-nuget | |
- name: Install Swashbuckle CLI | |
run: dotnet tool install -g Swashbuckle.AspNetCore.Cli | |
# Lets test not doing restore here since the next build step has restore already. | |
# - name: Install dependencies | |
# run: dotnet restore | |
- name: Build for linux-x64 | |
run: | | |
dotnet clean Kavita.sln -c Release | |
dotnet msbuild -restore Kavita.sln -p:Configuration=Release -p:Platform="Any CPU" -p:RuntimeIdentifiers=linux-x64 | |
- name: Package for 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/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: Test | |
run: dotnet test --no-restore --verbosity normal | |
- name: Didibreakit? | |
run: echo "If we get to this point we can add the other actioins for the different builds" |