Skip to content

Commit

Permalink
Update release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
lithiumtoast committed Aug 6, 2023
1 parent caee02f commit 34a807d
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
workflow_dispatch:
inputs:
upload-nuget-packages:
description: 'Is this a release-candidate? (Candidates get uploaded to MyGet.org instead of NuGet.org)'
description: 'Is this a release candidate (pre-release)? (NOTE: candidates get uploaded to MyGet.org instead of NuGet.org)'
required: true
default: 'true'
schedule:
Expand All @@ -16,16 +16,29 @@ jobs:
uses: "./.github/workflows/build.yml"

release-job:
name: "Release .NET solution"
name: "Release"
needs: [build-job]
runs-on: ubuntu-latest
permissions:
contents: write
steps:

- name: "Clone Git repository"
uses: actions/checkout@master
with:
submodules: "recursive"

- name: "Set version"
id: set-version
shell: bash
run: |
IS_PRERELEASE="${{ github.event.inputs.pre-release }}"
if [[ "$IS_PRERELEASE" = "true" ]]; then
echo "VERSION=$(date +'%Y.%m.%d')-rc" >> "$GITHUB_OUTPUT"
else
echo "VERSION=$(date +'%Y.%m.%d')" >> "$GITHUB_OUTPUT"
fi
- name: "Download native libraries (win-x64)"
uses: actions/download-artifact@v1
with:
Expand All @@ -44,12 +57,8 @@ jobs:
name: "native-libraries-linux-x64"
path: "./lib"

- name: "Set package version"
id: set-package-version
run: echo "PACKAGE_VERSION=$(date +'%Y.%m.%d')" >> "$GITHUB_OUTPUT"

- name: ".NET pack"
run: dotnet pack "./src/cs" --nologo --verbosity minimal --configuration Release -p:PackageVersion="${{ steps.set-package-version.outputs.PACKAGE_VERSION }}" -p:RepositoryBranch="${{ github.head_ref || github.ref_name }}" -p:RepositoryCommit="${{ github.sha }}"
run: dotnet pack "./src/cs" --nologo --verbosity minimal --configuration Release -p:PackageVersion="${{ steps.set-version.outputs.VERSION }}" -p:RepositoryBranch="${{ github.head_ref || github.ref_name }}" -p:RepositoryCommit="${{ github.sha }}"

- name: "Upload packages to MyGet"
if: github.event_name == 'workflow_dispatch' && github.event.inputs.pre-release == 'true'
Expand All @@ -58,7 +67,14 @@ jobs:
run: dotnet nuget push "./nupkg/**/*.nupkg" --source https://www.myget.org/F/bottlenoselabs/api/v3/index.json --skip-duplicate --api-key $MYGET_ACCESS_TOKEN

- name: "Upload packages to NuGet"
if: github.event_name == 'schedule' || github.event.inputs.pre-release != 'false'
if: github.event_name == 'schedule' || github.event.inputs.pre-release != 'true'
env:
NUGET_ACCESS_TOKEN: ${{ secrets.NUGET_ACCESS_TOKEN }}
run: dotnet nuget push "./nupkg/**/*.nupkg" --source https://api.nuget.org/v3/index.json --skip-duplicate --api-key $NUGET_ACCESS_TOKEN

- uses: ncipollo/release-action@v1
with:
generateReleaseNotes: true
makeLatest: true
prerelease: "{{ github.event.inputs.pre-release == 'true' }}"
tag: "v${{ steps.set-version.outputs.VERSION }}"

0 comments on commit 34a807d

Please sign in to comment.