Merge pull request #68 from Kareadita/feature/stats-v3 #122
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: .NET Build Test and Docker Deploy | |
on: | |
push: | |
branches: '**' | |
pull_request: | |
branches: [ main, develop ] | |
types: [synchronize] | |
jobs: | |
build: | |
name: Build .Net | |
runs-on: windows-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '9.0' | |
- name: Build | |
run: dotnet build --configuration Release | |
- 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" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: csproj | |
path: KavitaStats/KavitaStats.csproj | |
stable: | |
name: Build Docker and push | |
needs: [ build ] | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
steps: | |
- name: Find Current Pull Request | |
uses: jwalton/[email protected] | |
id: findPr | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Get csproj Version | |
uses: naminodarie/get-net-sdk-project-versions-action@v1 | |
id: get-version | |
with: | |
proj-path: KavitaStats/KavitaStats.csproj | |
- name: Echo csproj version | |
run: echo "${{steps.get-version.outputs.assembly-version}}" | |
- name: Parse Version | |
run: | | |
version='${{steps.get-version.outputs.assembly-version}}' | |
newVersion=${version%.*} | |
echo $newVersion | |
echo "::set-output name=VERSION::$newVersion" | |
id: parse-version | |
- name: Compile dotnet app | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '9.0' | |
- run: ./build.sh | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm/v7,linux/arm64 | |
push: true | |
tags: jvmilazz0/kavitastats:latest, jvmilazz0/kavitastats:${{ steps.parse-version.outputs.VERSION }} | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} |