Skip to content

Commit

Permalink
Add release steps for libs in actions pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
kMutagene committed Mar 7, 2024
1 parent b08be04 commit d5e02c7
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 12 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
jobs:
windows:
runs-on: windows-latest
name: "[windows] Build and test"
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -15,13 +14,12 @@ jobs:
with:
dotnet-version: 8.x.x
- name: Build
run: dotnet build ./arc-validate-package-registry.sln
run: dotnet build ./arc-validate-package-registry.sln --configuration Release
- name: Test
run: dotnet test ./arc-validate-package-registry.sln
run: dotnet test ./arc-validate-package-registry.sln --configuration Release --no-build

ubuntu:
runs-on: ubuntu-latest
name: "[ubuntu] Build and test"
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -30,13 +28,12 @@ jobs:
with:
dotnet-version: 8.x.x
- name: Build
run: dotnet build ./arc-validate-package-registry.sln
run: dotnet build ./arc-validate-package-registry.sln --configuration Release
- name: Test
run: dotnet test ./arc-validate-package-registry.sln
run: dotnet test ./arc-validate-package-registry.sln --configuration Release --no-build

macos:
runs-on: macos-latest
name: "[macOS] Build and test"
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -45,6 +42,6 @@ jobs:
with:
dotnet-version: 8.x.x
- name: Build
run: dotnet build ./arc-validate-package-registry.sln
- name: Test
run: dotnet test ./arc-validate-package-registry.sln
run: dotnet build ./arc-validate-package-registry.sln --configuration Release
- name: Test
run: dotnet test ./arc-validate-package-registry.sln --configuration Release --no-build
20 changes: 18 additions & 2 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,26 @@ jobs:
echo "dry run:"
echo "${{ steps.decide-on-dry-run.outputs.dry_run }}"
build:
build-and-test:
needs: setup
# https://github.com/actions/runner/issues/1173
if: (needs.setup.outputs.tests_any_changed == 'true' || needs.setup.outputs.api_any_changed == 'true' || needs.setup.outputs.client_any_changed == 'true' || needs.setup.outputs.index_any_changed == 'true') && needs.setup.outputs.is_dry_run == 'false'
uses: nfdi4plants/arc-validate-package-registry/.github/workflows/build-and-test.yml@main


release-index:
needs: [setup, build-and-test]
if: needs.setup.outputs.is_dry_run == 'false' && contains(needs.setup.outputs.index_all_changed_files, 'RELEASE_NOTES.md')
uses: nfdi4plants/arc-validate-package-registry/.github/workflows/release-package.yml@main
with:
package: project
secrets:
NUGET_KEY: ${{ secrets.NUGET_KEY }}

release-client:
needs: [setup, build-and-test]
if: needs.setup.outputs.is_dry_run == 'false' && contains(needs.setup.outputs.client_all_changed_files, 'RELEASE_NOTES.md')
uses: nfdi4plants/arc-validate-package-registry/.github/workflows/release-package.yml@main
with:
package: client
secrets:
NUGET_KEY: ${{ secrets.NUGET_KEY }}
28 changes: 28 additions & 0 deletions .github/workflows/release-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "Release Packages"

on:
workflow_call:
inputs:
project:
required: true
type: string
description: "The project to release"
secrets:
NUGET_KEY:
required: true
description: "The key that allows pushing packages to nuget"

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x.x
- name: pack
run: dotnet pack ${{ github.event.inputs.project }} --configuration Release -o ./pkg
- name: push
run: dotnet nuget push ./pkg/*.nupkg --api-key ${{ secrets.nuget_key }} --source https://api.nuget.org/v3/index.json

0 comments on commit d5e02c7

Please sign in to comment.