Skip to content

Commit

Permalink
Moved workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
droyad committed Mar 19, 2024
1 parent a2ef798 commit de99008
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ name: CI
on:
workflow_call:

permissions:
packages: write

jobs:
build:
runs-on: ubuntu-latest

env:
DOTNET_NOLOGO: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # Avoid pre-populating the NuGet package cache
ASSENTNONINTERACTIVE: true
Expand Down Expand Up @@ -58,16 +60,20 @@ jobs:
if: ${{ format('{0}', secrets.GITHUB_TOKEN) != '' && startsWith(github.repository, 'DbUp/') }}
working-directory: artifacts
run: dotnet nuget push *.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/DbUp/index.json"

- name: Push NuGet packages to NuGet ⬆️
if: ${{ steps.gitversion.outputs.preReleaseLabel == '' }}
working-directory: artifacts
run: dotnet nuget push *.nupkg --api-key ${{ secrets.NUGET_APIKEY }} --source https://api.nuget.org/v3/index.json

- name: Test Report 🧪
uses: dorny/test-reporter@v1
if: ${{ always() }}
# https://github.com/dorny/test-reporter#recommended-setup-for-public-repositories
- name: Upload Test Results
uses: actions/upload-artifact@v3 # upload test results
if: success() || failure() # run this step even if previous step failed
with:
name: Tests
name: test-results
path: artifacts/*.trx
reporter: dotnet-trx

- name: Create GitHub Release
if: ${{ (github.ref_name == 'main' || startsWith(github.ref_name, 'release/')) && format('{0}', env.GITHUB_TOKEN) != '' }}
shell: pwsh
working-directory: artifacts
# Can't just use wildcard in this command due to https://github.com/cli/cli/issues/5099 so use Get-Item
run: gh release create --draft ${{ github.ref_name == 'main' && '' || '--prerelease' }} --target ${{ github.ref_name }} --title $GitVersion_SemVer $GitVersion_SemVer (Get-Item dbup-core.*.nupkg)

GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31 changes: 31 additions & 0 deletions .github/workflows/ReusableWorkflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish DbUp Packages to NuGet

on:
workflow_call:

jobs:
publish:
name: "Publish Package"
runs-on: ubuntu-latest

env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # Avoid pre-populating the NuGet package cache

steps:
- name: "Check Tag Value"
run: echo ${{ github.event.release.tag_name }}

- uses: robinraju/[email protected]
name: "Download Package from Release"
with:
repository: "${{ github.repository }}"
token: ${{ secrets.GITHUB_TOKEN }}
tag: "${{ github.event.release.tag_name }}"
fileName: "*"
tarBall: false
zipBall: false

- name: "Upload to NuGet"
run: dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --skip-duplicate --api-key ${{ secrets.NUGET_APIKEY }}
26 changes: 26 additions & 0 deletions .github/workflows/ReusableWorkflows/test-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Test Report
run-name: Generate Test Report for workflow ${{ github.event.workflow_run.name }} run ${{ github.event.workflow_run.run_number }} branch ${{ github.event.workflow_run.head_branch }}

# https://github.com/dorny/test-reporter#recommended-setup-for-public-repositories
# This workflow is for test report

on:
workflow_call:

permissions:
contents: read
actions: read
checks: write

jobs:
report:
runs-on: ubuntu-latest
steps:
- name: Test Report 🧪
uses: dorny/test-reporter@v1
with:
artifact: test-results
name: Unit Tests
path: "*.trx"
reporter: dotnet-trx
fail-on-error: false

0 comments on commit de99008

Please sign in to comment.