From 06a2871e73e47c88a89cb23086809d86ccbeb076 Mon Sep 17 00:00:00 2001 From: Todd Anderson Date: Tue, 13 Feb 2024 09:33:58 -0600 Subject: [PATCH 1/2] ci: adds support for release please --- .github/actions/publish/action.yml | 2 +- .github/workflows/publish.yml | 14 +++++++- .github/workflows/release-please.yml | 32 +++++++++++++++++++ .release-please-manifest.json | 3 ++ release-please-config.json | 15 +++++++++ .../LaunchDarkly.ClientSdk.csproj | 2 ++ 6 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release-please.yml create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json diff --git a/.github/actions/publish/action.yml b/.github/actions/publish/action.yml index 822ce42..0b4389b 100644 --- a/.github/actions/publish/action.yml +++ b/.github/actions/publish/action.yml @@ -31,5 +31,5 @@ runs: for pkg in $(find ./nupkgs -name '*.nupkg' -o -name '*.snupkg'); do echo "publishing ${pkg}" dotnet nuget push "${pkg}" -ApiKey ${{ env.NUGET_API_KEY }} -Source https://www.nuget.org - echo "published $pkg" + echo "published ${pkg}" done diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a045ba8..b5b1385 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,7 +5,19 @@ on: run_tests: description: 'If true, run unit tests, otherwise skip them.' required: false - default: 'true' + type: boolean + default: true + dry_run: + description: 'Is this a dry run. If so no package will be published.' + type: boolean + required: true + workflow_call: + inputs: + run_tests: + description: 'If true, run unit tests, otherwise skip them.' + required: false + type: boolean + default: true dry_run: description: 'Is this a dry run. If so no package will be published.' type: boolean diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..31cdd4c --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,32 @@ +name: Release Please +on: + push: + branches: + - main + +jobs: + release-please: + runs-on: ubuntu-latest + + permissions: + id-token: write # Needed if using OIDC to get release secrets. + contents: write # Contents and pull-requests are for release-please to make releases. + pull-requests: write + + outputs: + releases_created: ${{ steps.release.outputs.releases_created }} + + steps: + - uses: google-github-actions/release-please-action@v4 + id: release + with: + token: ${{ secrets.GITHUB_TOKEN }} + target-branch: ${{ github.ref_name }} + + call-workflow-publish: + needs: release-please + uses: ./.github/workflows/publish.yml + if: ${{ needs.release-please.outputs.releases_created == 'true' }} + with: + run_tests: true + dry_run: true diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..e6f8775 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "4.0.0" +} diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..9f0f6d6 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,15 @@ +{ + "bootstrap-sha": "ffc2e94144f2a4ddfd5f42e09c228713d4510fd6", + "packages": { + ".": { + "release-type": "simple", + "bump-minor-pre-major": true, + "versioning": "default", + "include-v-in-tag": false, + "include-component-in-tag": false, + "extra-files": [ + "src/LaunchDarkly.ClientSdk/LaunchDarkly.ClientSdk.csproj" + ] + } + } +} diff --git a/src/LaunchDarkly.ClientSdk/LaunchDarkly.ClientSdk.csproj b/src/LaunchDarkly.ClientSdk/LaunchDarkly.ClientSdk.csproj index 5b606e3..d57254c 100644 --- a/src/LaunchDarkly.ClientSdk/LaunchDarkly.ClientSdk.csproj +++ b/src/LaunchDarkly.ClientSdk/LaunchDarkly.ClientSdk.csproj @@ -1,7 +1,9 @@ + 5.0.0-alpha.2 +