Feature/version bump test (#449)

## Changes
- Reconfigured Github workflow for better visibility
- Added automated version bump on merge push to Develop branch
This commit is contained in:
Robbie Davis 2021-08-02 08:22:33 -04:00 committed by GitHub
parent 2f8af9f8e6
commit e3cfbadd9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 155 additions and 51 deletions

View File

@ -1,9 +1,7 @@
name: Build Nightly Docker
on:
push:
branches:
- 'develop'
workflow_dispatch:
jobs:
docker:
@ -13,6 +11,8 @@ jobs:
- name: Check Out Repo
uses: actions/checkout@v2
with:
ref: develop
- name: NodeJS to Compile WebUI
uses: actions/setup-node@v2.1.5

View File

@ -9,7 +9,35 @@ on:
jobs:
build:
name: Build and Scan
name: Build .Net
runs-on: windows-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100
- name: Install dependencies
run: dotnet restore
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.11
- uses: actions/upload-artifact@v2
with:
name: csproj
path: Kavita.Common/Kavita.Common.csproj
test:
name: Install Sonar & Test
needs: build
runs-on: windows-latest
steps:
- name: Checkout Repo
@ -52,7 +80,7 @@ jobs:
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: Build and analyze
- name: Sonar Scan
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
@ -64,3 +92,121 @@ jobs:
- name: Test
run: dotnet test --no-restore --verbosity normal
bump:
name: Create branch for bump if Develop push
runs-on: ubuntu-latest
needs: [ build, test ]
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' }}
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
- 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: Get branch name
id: branch-name
uses: tj-actions/branch-names@v4.5
- name: Echo branch name
run: echo "${{ steps.branch-name.outputs.current_branch }}"
- name: Echo csproj version
run: echo "${{steps.get-version.outputs.assembly-version}}"
- name: Create Branch
uses: peterjgrainger/action-create-branch@v2.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: "version-bump"
version:
name: Bump version if Develop push
needs: [ bump ]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' }}
steps:
- name: Download a single artifact
uses: actions/download-artifact@v2
with:
name: csproj
- name: Get csproj Version
uses: naminodarie/get-net-sdk-project-versions-action@v1
id: get-version
with:
proj-path: Kavita.Common.csproj
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v4.5
- uses: actions/checkout@v2
with:
ref: version-bump
fetch-depth: 0
- name: Create local changes for reference
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git pull origin version-bump-${{steps.get-version.outputs.assembly-version}}
git commit --allow-empty -m "Trigger Build"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: version-bump-${{steps.get-version.outputs.assembly-version}}
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Bump versions
uses: SiqiLu/dotnet-bump-version@master
with:
version_files: Kavita.Common/Kavita.Common.csproj
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Merge bump branch -> pr branch
uses: devmasx/merge-branch@v1.3.1
with:
type: now
from_branch: version-bump-${{ github.event.inputs.version }}
target_branch: develop
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Trigger Docker Nightly
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' }}
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Build Nightly Docker
token: ${{ secrets.REPO_GHA_PAT }}
stable:
name: Trigger Stable Docker if Main push
needs: [ build, test ]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' }}
steps:
- name: If Push to Main, Trigger Docker Stable
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Build Stable Docker
token: ${{ secrets.REPO_GHA_PAT }}

View File

@ -1,9 +1,7 @@
name: Build Stable Docker
on:
push:
branches:
- 'main'
workflow_dispatch:
jobs:
docker:
@ -12,6 +10,8 @@ jobs:
- name: Check Out Repo
uses: actions/checkout@v2
with:
ref: main
- name: NodeJS to Compile WebUI
uses: actions/setup-node@v2.1.5
@ -99,7 +99,7 @@ jobs:
uses: rjstone/discord-webhook-notify@v1
with:
severity: info
description:
description: ${{ github.event.body }}
details: 'https://hub.docker.com/r/kizaing/kavita/tags?page=1&ordering=last_updated'
text: A new stable build has been released for docker.
webhookUrl: ${{ secrets.DISCORD_DOCKER_UPDATE_URL }}

View File

@ -1,42 +0,0 @@
name: Bump .Net Version
on:
push:
branches:
- 'version-bump'
jobs:
bump:
name: Version bump
runs-on: windows-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: version-bump
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Bump versions
uses: SiqiLu/dotnet-bump-version@master
with:
version_files: Kavita.Common/Kavita.Common.csproj
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Merge bump branch -> pr branch
uses: devmasx/merge-branch@v1.3.1
with:
type: now
from_branch: version-bump
target_branch: ${{ github.event.inputs.branch }}
github_token: ${{ secrets.GITHUB_TOKEN }}