Skip to content

Commit

Permalink
chore: Change order of checkout versus secret access. Remove bad git …
Browse files Browse the repository at this point in the history
…ignore. Add publish action. (#27)

The git ignore file prevented the publish action from being committed.
The checkout was deleting the SNK.
  • Loading branch information
kinyoklion authored Nov 19, 2024
1 parent 0015906 commit fdd5a44
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 4 deletions.
50 changes: 50 additions & 0 deletions .github/actions/publish/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Publish Package
description: '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
outputs:
hashes:
description: sha256sum hashes of built artifacts
value: ${{ steps.hash.outputs.hashes }}

runs:
using: composite
steps:
- name: Setup dotnet build tools
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0

- name: Create Nuget Package
shell: bash
run: |
dotnet restore ./src/LaunchDarkly.Logging.Microsoft/LaunchDarkly.Logging.Microsoft.csproj
dotnet pack --no-build --output nupkgs --configuration Release ./src/LaunchDarkly.Logging.Microsoft/LaunchDarkly.Logging.Microsoft.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: Hash nuget packages
id: hash
if: ${{ inputs.dry_run == 'false' }}
shell: bash
run: |
echo "hashes=$(sha256sum ./nupkgs/*.nupkg ./nupkgs/*.snupkg | base64 -w0)" >> "$GITHUB_OUTPUT"
- 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
3 changes: 2 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
pull-requests: write

steps:
- uses: actions/checkout@v4

- uses: launchdarkly/gh-actions/actions/[email protected]
name: Get secrets
with:
Expand All @@ -44,7 +46,6 @@ jobs:
/production/common/releasing/nuget/api_key = NUGET_API_KEY'
s3_path_pairs: 'launchdarkly-releaser/dotnet/LaunchDarkly.Logging.snk = LaunchDarkly.Logging.snk'

- uses: actions/checkout@v4

- name: Build Release
uses: ./.github/actions/release-build
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish

# Others
[Bb]in
[Oo]bj
Expand Down

0 comments on commit fdd5a44

Please sign in to comment.