-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add github CI and release-please. (#8)
- Loading branch information
1 parent
912e244
commit 1ec959e
Showing
20 changed files
with
343 additions
and
105 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: Build Documentation | ||
description: 'Build Documentation.' | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Build Documentation | ||
shell: bash | ||
run: | | ||
dotnet tool update -g docfx | ||
docfx metadata | ||
docfx build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# This is a composite to allow sharing these steps into other workflows. | ||
# For instance it could be used by regular CI as well as the release process. | ||
|
||
name: CI Workflow | ||
description: 'Shared CI workflow.' | ||
inputs: | ||
run_tests: | ||
description: 'If true, run unit tests, otherwise skip them.' | ||
required: false | ||
default: 'true' | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Setup dotnet build tools | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 7.0 | ||
|
||
- name: Restore dotnet dependencies | ||
shell: bash | ||
id: restore | ||
run: dotnet restore | ||
|
||
- name: Build | ||
shell: bash | ||
id: build | ||
run: dotnet build | ||
|
||
- name: Run Tests | ||
if: steps.build.outcome == 'success' && inputs.run_tests == 'true' | ||
shell: bash | ||
run: dotnet test | ||
|
||
# We build documentation during CI to ensure it can always build prior to a | ||
# release. | ||
- name: Build documentation | ||
if: steps.build.outcome == 'success' | ||
uses: ./.github/actions/build-docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Publish Documentation | ||
description: 'Publish the documentation to X' | ||
inputs: | ||
token: | ||
description: 'Token to use for publishing.' | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: launchdarkly/gh-actions/actions/publish-pages@publish-pages-v1.0.1 | ||
name: 'Publish to Github pages' | ||
with: | ||
docs_path: docs | ||
github_token: ${{ inputs.token }} # For the shared action the token should be a GITHUB_TOKEN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Publish | ||
description: 'Dotnet Logging Adapter NLog action that packs DLLs into unsigned Nuget package and publishes to Nuget.' | ||
inputs: | ||
dry_run: | ||
description: 'Is this a dry run. If so no package will be published.' | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Create Nuget Package | ||
shell: bash | ||
run: | | ||
dotnet restore | ||
dotnet pack --no-build --output nupkgs --configuration Release src/LaunchDarkly.Logging.NLog/LaunchDarkly.Logging.NLog.csproj | ||
- name: Publish Package | ||
if: ${{ inputs.dry_run == 'false' }} | ||
shell: bash | ||
run: | | ||
for pkg in $(find ./nupkgs -name '*.nupkg' -o -name '*.snupkg'); do | ||
echo "publishing ${pkg}" | ||
dotnet nuget push "${pkg}" --api-key ${{ env.NUGET_API_KEY }} --source https://www.nuget.org | ||
echo "published ${pkg}" | ||
done | ||
- name: Dry Run Publish | ||
if: ${{ inputs.dry_run == 'true' }} | ||
shell: bash | ||
run: | | ||
echo "This is a dry run and packages are not being published." | ||
for pkg in $(find ./nupkgs -name '*.nupkg' -o -name '*.snupkg'); do | ||
echo "detected package ${pkg}" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Release Build | ||
description: 'Build in Release Configuration' | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Setup dotnet build tools | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 7.0 | ||
|
||
- name: Restore Packages | ||
shell: bash | ||
run: dotnet restore | ||
|
||
- name: Build | ||
shell: bash | ||
run: dotnet build /p:Configuration=Release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Run CI | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ 'main' ] | ||
paths-ignore: | ||
- '**.md' # Do not need to run CI for markdown changes. | ||
pull_request: | ||
branches: [ 'main' ] | ||
paths-ignore: | ||
- '**.md' | ||
|
||
jobs: | ||
ci-build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # If you only need the current version keep this. | ||
|
||
- uses: ./.github/actions/ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: Lint PR title | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
|
||
jobs: | ||
lint-pr-title: | ||
uses: launchdarkly/gh-actions/.github/workflows/lint-pr-title.yml@main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
on: | ||
workflow_dispatch: | ||
|
||
name: Publish Documentation | ||
jobs: | ||
build-publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write # Needed in this case to write github pages. | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- id: build | ||
name: Build and Test | ||
uses: ./.github/actions/ci | ||
|
||
- id: publish | ||
name: Publish Documentation | ||
uses: ./.github/actions/publish-docs | ||
with: | ||
token: ${{secrets.GITHUB_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: Publish Package | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
run_tests: | ||
description: 'If true, run unit tests, otherwise skip them.' | ||
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 | ||
required: true | ||
|
||
jobs: | ||
# Building is done on mac runner due to xcode build dependencies | ||
build-and-publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # If you only need the current version keep this | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # If you only need the current version keep this | ||
|
||
- name: CI check | ||
uses: ./.github/actions/ci | ||
with: | ||
run_tests: ${{ inputs.run_tests }} | ||
|
||
- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.1.0 | ||
name: Get secrets | ||
with: | ||
aws_assume_role: ${{ vars.AWS_ROLE_ARN }} | ||
ssm_parameter_pairs: '/production/common/releasing/digicert/host = DIGICERT_HOST, | ||
/production/common/releasing/digicert/api_key = DIGICERT_API_KEY, | ||
/production/common/releasing/digicert/client_cert_file_b64 = DIGICERT_CLIENT_CERT_FILE_B64, | ||
/production/common/releasing/digicert/client_cert_password = DIGICERT_CLIENT_CERT_PASSWORD, | ||
/production/common/releasing/digicert/code_signing_cert_sha1_hash = DIGICERT_CODE_SIGNING_CERT_SHA1_HASH, | ||
/production/common/releasing/nuget/api_key = NUGET_API_KEY' | ||
s3_path_pairs: 'launchdarkly-releaser/dotnet/LaunchDarkly.Logging.snk = LaunchDarkly.Logging.snk' | ||
|
||
- name: Release Build | ||
uses: ./.github/actions/release-build | ||
|
||
- name: Sign DLLs | ||
uses: launchdarkly/gh-actions/actions/sign-dlls@sign-dlls-v1.0.0 | ||
with: | ||
build_configuration_path: "src/LaunchDarkly.Logging.NLog/bin/Release/" | ||
dll_name: 'LaunchDarkly.Logging.NLog.dll' | ||
|
||
- name: Publish Nupkg | ||
uses: ./.github/actions/publish | ||
with: | ||
dry_run: ${{ inputs.dry_run }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Run 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: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.