Feature/version bump (#456)

** Changes
- Workflow changes
This commit is contained in:
Robbie Davis 2021-08-02 09:54:57 -04:00 committed by GitHub
parent 74dc6fd5dc
commit 912469de12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 59 deletions

View File

@ -2,7 +2,7 @@ name: .NET Build Test and Sonar Scan
on: on:
push: push:
branches: [ main, develop ] branches: '**'
pull_request: pull_request:
branches: [ main, develop ] branches: [ main, develop ]
types: [opened, synchronize, reopened] types: [opened, synchronize, reopened]
@ -93,63 +93,14 @@ jobs:
- name: Test - name: Test
run: dotnet test --no-restore --verbosity normal 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-${{steps.get-version.outputs.assembly-version}}"
version: version:
name: Bump version if Develop push name: Bump version on Develop push
needs: [ bump ] needs: [ build, test ]
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' }} if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' }}
steps: 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 - uses: actions/checkout@v2
with: with:
ref: version-bump-${{steps.get-version.outputs.assembly-version}}
fetch-depth: 0 fetch-depth: 0
- name: Setup .NET Core - name: Setup .NET Core
@ -167,10 +118,16 @@ jobs:
uses: SiqiLu/dotnet-bump-version@master uses: SiqiLu/dotnet-bump-version@master
with: with:
version_files: Kavita.Common/Kavita.Common.csproj version_files: Kavita.Common/Kavita.Common.csproj
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.REPO_GHA_PAT }}
- name: Trigger Docker Nightly develop:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' }} name: Trigger 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: If Push to Develop, Trigger Docker Stable
uses: benc-uk/workflow-dispatch@v1 uses: benc-uk/workflow-dispatch@v1
with: with:
workflow: Build Nightly Docker workflow: Build Nightly Docker
@ -180,12 +137,11 @@ jobs:
name: Trigger Stable Docker if Main push name: Trigger Stable Docker if Main push
needs: [ build, test ] needs: [ build, test ]
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' }} if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
steps: steps:
- name: If Push to Main, Trigger Docker Stable - name: If Push to Main, Trigger Docker Stable
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: benc-uk/workflow-dispatch@v1 uses: benc-uk/workflow-dispatch@v1
with: with:
workflow: Build Stable Docker workflow: Build Stable Docker
token: ${{ secrets.REPO_GHA_PAT }} token: ${{ secrets.REPO_GHA_PAT }}

View File

@ -19,4 +19,4 @@
</ItemGroup> </ItemGroup>
</Project> </Project>