Adding Additional Workflows and Actions (#397)

* Cleaning and adding to workflows

- Renamed some workflows to better describe it's purpose.
- Added steps for autobump
- Added steps for sentry maps
- Manually pushing sentry map workflow to git initially so it exists already for the workflow-dispatch trigger. Will need to add another commit to revert workflow back to only trigger on dispatch.

* Fixing and cleaning workflow

- Removed unused discord workflow
- Changed sentry map workflow to differentiate between another workflow.
- Changed name of new renamed sentry workflow in dispatches.

* Updating sentry workflow with dispatch trigger

* fixing webui path issue for docker builds
This commit is contained in:
Robbie Davis 2021-07-17 16:05:40 -04:00 committed by GitHub
parent 2a34fe4cc7
commit b5f92d46a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 115 additions and 105 deletions

View File

@ -1,17 +0,0 @@
name: Release messages to discord announcement channel
on:
release:
types:
- created
jobs:
run_main:
runs-on: ubuntu-18.04
name: Sends custom message
steps:
- name: Sending message
uses: nhevia/discord-styled-releases@main
with:
webhook_id: ${{ secrets.DISCORD_WEBHOOK_ID }}
webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}

View File

@ -1,38 +0,0 @@
name: Monorepo Build Test
on:
push:
branches:
- 'feature/monorepo'
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v2
- name: NodeJS to Compile WebUI
uses: actions/setup-node@v2.1.5
with:
node-version: '14'
- run: |
cd UI/Web || exit
echo 'Installing web dependencies'
npm install
echo 'Building UI'
npm run prod
echo 'Copying back to Kavita wwwroot'
rsync -a dist/ ../../API/wwwroot/
cd ../ || exit
- name: Compile dotnet app
uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.x'
- run: ./monorepo-build.sh

View File

@ -7,6 +7,7 @@ on:
jobs:
docker:
name: Building Nightly Docker
runs-on: ubuntu-latest
steps:
@ -18,7 +19,6 @@ jobs:
with:
node-version: '14'
- run: |
cd UI/Web || exit
echo 'Installing web dependencies'
npm install
@ -31,12 +31,34 @@ jobs:
cd ../ || exit
- name: Bump versions
uses: SiqiLu/dotnet-bump-version@master
with:
version_files: "Kavita.Common/Kavita.Common.csproj"
github_token: ${{ secrets.GITHUB_TOKEN }}
- 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: Echo csproj version
run: echo "${{steps.get-version.outputs.assembly-version}}"
- name: Compile dotnet app
uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.x'
- run: ./monorepo-build.sh
- name: Trigger Sentry workflow
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Sentry Map Release
token: ${{ secrets.REPO_GHA_PAT }}
inputs: '{ "version": "${{steps.get-version.outputs.assembly-version}}" }'
- name: Login to Docker Hub
uses: docker/login-action@v1
with:

63
.github/workflows/sentry-map.yml vendored Normal file
View File

@ -0,0 +1,63 @@
name: Sentry Map Release
on:
workflow_dispatch:
inputs:
version:
description: "version to update package.json"
required: true
# No default
jobs:
build:
name: Setup Sentry CLI
runs-on: ubuntu-latest
steps:
- uses: mathieu-bour/setup-sentry-cli@1.2.0
with:
version: latest
token: ${{ secrets.SENTRY_TOKEN }}
organization: kavita-7n
project: angular
- name: Check out repository
uses: actions/checkout@v2
- name: Parse Version
run: |
version='${{ github.event.inputs.version }}'
newVersion=${version%.*}
echo $newVersion
echo "::set-output name=VERSION::$newVersion"
id: parse-version
- name: NodeJS to Compile WebUI
uses: actions/setup-node@v2.1.5
with:
node-version: '14'
- run: |
cd UI/Web || exit
echo 'Installing web dependencies'
npm install
npm version --allow-same-version "${{ steps.parse-version.outputs.VERSION }}"
echo 'Building UI'
npm run prod
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Create Release
run: sentry-cli releases new ${{ steps.parse-version.outputs.VERSION }}
- name: Upload Source Maps
run: sentry-cli releases files ${{ steps.parse-version.outputs.VERSION }} upload-sourcemaps UI/Web/dist
- name: Finalize Release
run: sentry-cli releases finalize ${{ steps.parse-version.outputs.VERSION }}

View File

@ -1,42 +0,0 @@
name: Sentry Release
on:
push:
branches: [ main, develop, feature/sentry-release ]
jobs:
build:
name: Setup Sentry CLI
runs-on: ubuntu-latest
steps:
- uses: mathieu-bour/setup-sentry-cli@1.2.0
with:
version: latest
token: ${{ SECRETS.SENTRY_TOKEN }}
organization: kavita-7n
project: angular
- name: Checkout
uses: actions/checkout@v2
- name: Install NodeJS
uses: actions/setup-node@v2
with:
node-version: '12'
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Dependencies
run: npm install
- name: Build Angular
run: npm run prod
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@master
- name: Create Release
run: sentry-cli releases new ${{ steps.package-version.outputs.current-version }}
- name: Upload Source Maps
run: sentry-cli releases files ${{ steps.package-version.outputs.current-version }} upload-sourcemaps ./dist
- name: Finalize Release
run: sentry-cli releases finalize ${{ steps.package-version.outputs.current-version }}

View File

@ -1,4 +1,4 @@
name: .NET Core Build
name: .NET Build Test and Sonar Scan
on:
push:
@ -9,31 +9,34 @@ on:
jobs:
build:
name: Build
name: Build and Scan
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- 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/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v1
@ -41,12 +44,14 @@ jobs:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
@ -56,5 +61,6 @@ jobs:
.\.sonar\scanner\dotnet-sonarscanner begin /k:"Kareadita_Kavita" /o:"kareadita" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
dotnet build --configuration Release
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
- name: Test
run: dotnet test --no-restore --verbosity normal

View File

@ -31,12 +31,28 @@ jobs:
cd ../ || exit
- 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: Echo csproj version
run: echo "${{steps.get-version.outputs.assembly-version}}"
- name: Compile dotnet app
uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.x'
- run: ./monorepo-build.sh
- name: Trigger Sentry workflow
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Sentry Map Release
token: ${{ secrets.REPO_GHA_PAT }}
inputs: '{ "version": "${{steps.get-version.outputs.assembly-version}}" }'
- name: Login to Docker Hub
uses: docker/login-action@v1
with:

View File

@ -8,7 +8,7 @@ ARG TARGETPLATFORM
#Move the output files to where they need to be
RUN mkdir /files
COPY _output/*.tar.gz /files/
COPY Kavita-webui/dist /files/wwwroot
COPY UI/Web/dist /files/wwwroot
COPY copy_runtime.sh /copy_runtime.sh
RUN /copy_runtime.sh