ci: 👷 Finished build and PR pipelines

pull/4329/head
tidusjar 3 years ago
parent 9287d83c13
commit 44e573d993

@ -2,8 +2,7 @@ name: CI Build
on:
push:
# branches: [ develop, feature/** ]
branches: [ releaseNotes ]
branches: [ develop, master ]
jobs:
build-ui:
@ -54,40 +53,35 @@ jobs:
cd src
dotnet test --logger trx --results-directory "TestResults"
## Don't need yet
# - name: Upload dotnet test results
# uses: actions/upload-artifact@v2
# with:
# name: dotnet-results
# path: src/TestResults
# # Use always() to always run this step to publish test results when there are test failures
# if: ${{ always() }}
# versioning:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# # This is only to get the next version number so we can set the version before compile
# - name: Conventional Changelog Action
# id: changelog
# uses: TriPSs/conventional-changelog-action@v3
# with:
# github-token: ${{ secrets.github_token }}
# skip-version-file: 'true'
# skip-commit: 'true'
# version-file: 'version.json'
# output-file: 'false'
# skip-on-empty: 'false'
# - name: Output version
# run: |
# echo "outputs: ${{ steps.changelog.outputs.tag }}"
# echo "Version: ${{ steps.changelog.outputs.version }}"
# echo "log: ${{ steps.changelog.outputs.clean_changelog }}"
versioning:
runs-on: ubuntu-latest
outputs:
changelog: ${{ steps.changelog.outputs.clean_changelog }}
tag: ${{ steps.changelog.outputs.tag }}
version: ${{ steps.changelog.outputs.version }}
steps:
- uses: actions/checkout@v2
# This is only to get the next version number so we can set the version before compile
- name: Conventional Changelog Action
id: changelog
uses: TriPSs/conventional-changelog-action@v3
with:
skip-version-file: 'true'
skip-commit: 'true'
version-file: 'version.json'
output-file: 'false'
skip-on-empty: 'false'
git-push: 'false'
- name: Output version
run: |
echo "outputs: ${{ steps.changelog.outputs.tag }}"
echo "Version: ${{ steps.changelog.outputs.version }}"
echo "log: ${{ steps.changelog.outputs.clean_changelog }}"
publish:
runs-on: ubuntu-latest
needs: [ build-ui ]
needs: [ build-ui, versioning ]
strategy:
matrix:
include:
@ -120,22 +114,22 @@ jobs:
restore-keys: |
${{ runner.os }}-nuget
# This is only to get the next version number so we can set the version before compile
- name: Conventional Changelog Action
id: changelog
uses: TriPSs/conventional-changelog-action@v3
with:
github-token: ${{ secrets.github_token }}
skip-version-file: 'true'
skip-commit: 'true'
version-file: 'version.json'
output-file: 'false'
skip-on-empty: 'false'
# - name: Conventional Changelog Action
# id: changelog
# uses: TriPSs/conventional-changelog-action@v3.7.1
# with:
# github-token: ${{ secrets.WORKFLOW_PAT }}
# git-message: 'chore(release): {version}'
# version-file: 'version.json'
# output-file: 'CHANGELOG.md'
# skip-on-empty: 'false'
#env:
# ENV: 'dont-use-git'
- name: Set Backend Version
run: |
dotnet tool install -g dotnet-setversion
setversion -r ${{ steps.changelog.outputs.version }}
setversion -r ${{ needs.versioning.outputs.version }}
working-directory: src
- name: Publish Backend ${{ matrix.os }}
@ -176,55 +170,63 @@ jobs:
./src/Ombi/${{ matrix.os }}.${{ matrix.format }}
release:
needs: [ publish, unit-test ]
needs: [ publish, unit-test, versioning ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Conventional Changelog Action
id: changelog
uses: TriPSs/conventional-changelog-action@v3
with:
github-token: ${{ secrets.github_token }}
git-message: 'chore(release): {version}'
version-file: 'version.json'
output-file: 'CHANGELOG.md'
- name: Download Artifacts
id: download
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Publish to GitHub
- name: Publish to GitHub Master
uses: softprops/action-gh-release@v1
if: contains(github.ref, 'master')
with:
body: ${{ needs.versioning.outputs.changelog }}
name: ${{ needs.versioning.outputs.tag }}
tag_name: ${{ needs.versioning.outputs.tag }}
files: |
artifacts/**/*.tar.gz
artifacts/**/*.zip
- name: Publish to GitHub Develop
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
if: contains(github.ref, 'develop')
with:
body: ${{ steps.changelog.outputs.clean_changelog }}
draft: 'true'
name: ${{ steps.changelog.outputs.tag }}
tag_name: ${{ steps.changelog.outputs.tag }}
prerelease: true
body: ${{ needs.versioning.outputs.changelog }}
name: ${{ needs.versioning.outputs.tag }}
tag_name: ${{ needs.versioning.outputs.tag }}
files: |
artifacts/**/*.tar.gz
artifacts/**/*.zip
# - name: Publish to GitHub
# uses: softprops/action-gh-release@v1
# # if: startsWith(github.ref, 'refs/tags/')
# with:
# body: 'Test'
# draft: 'true'
# name: 'Test'
# files: |
# artifacts/**/*.tar.gz
# artifacts/**/*.zip
update-changelog:
needs: [ release ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Conventional Changelog Action
id: changelog
uses: TriPSs/conventional-changelog-action@v3
with:
version-file: 'version.json'
skip-on-empty: 'false'
git-message: 'chore(release): :rocket: {version}'
update-apt:
needs: [ release ]
runs-on: ubuntu-latest
steps:
- name: Trigger APT Build
uses: fjogeleit/http-request-action@master
with:
url: 'https://api.github.com/repos/Ombi-app/Ombi.Apt/actions/workflows/build-deb.yml/dispatches'
method: 'POST'
contentType: 'application/json'
data: "{ 'ref':'main', 'inputs': { 'version': '${{ steps.changelog.outputs.tag }}'} }"
customHeaders: "{'Accept':'application/vnd.github.v3+json', 'Authorization':'Bearer ${{secrets.APT_PAT}}', 'User-Agent':'Ombi'}"
uses: fjogeleit/http-request-action@master
with:
url: 'https://api.github.com/repos/Ombi-app/Ombi.Apt/actions/workflows/build-deb.yml/dispatches'
method: 'POST'
contentType: 'application/json'
data: "{ 'ref':'main', 'inputs': { 'version': '${{ steps.changelog.outputs.tag }}'} }"
customHeaders: "{'Accept':'application/vnd.github.v3+json', 'Authorization':'Bearer ${{secrets.APT_PAT}}', 'User-Agent':'Ombi'}"

@ -2,7 +2,7 @@ name: PR Build
on:
pull_request:
branches: [ develop ]
types: [opened, synchronize, reopened]
jobs:
build-ui:
@ -46,19 +46,26 @@ jobs:
cd src
dotnet test --logger trx --results-directory "TestResults"
## Don't need yet
# - name: Upload dotnet test results
# uses: actions/upload-artifact@v2
# with:
# name: dotnet-results
# path: src/TestResults
# # Use always() to always run this step to publish test results when there are test failures
# if: ${{ always() }}
analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
with:
args: >
-Dsonar.organization=ombi-app
-Dsonar.projectKey=Ombi-app_Ombi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
publish:
runs-on: ubuntu-latest
needs: [ build-ui ]
needs: [ unit-test ]
strategy:
matrix:
include:

Loading…
Cancel
Save