Skip to content

Revert "Remove pull-request trigger again." #6

Revert "Remove pull-request trigger again."

Revert "Remove pull-request trigger again." #6

Workflow file for this run

name: Pack and push to GitHub packages
on:
push:
branches:
- main
- \d+\.x
workflow_call:
jobs:
pack:
runs-on: ubuntu-latest
outputs:
semVer2: ${{ steps.nbgv.outputs.SemVer2 }}
isPreviewRelease: ${{ startsWith(steps.nbgv.outputs.PrereleaseVersionNoLeadingHyphen, 'preview') }}
isStableRelease: ${{ steps.nbgv.outputs.PrereleaseVersionNoLeadingHyphen == '' }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: 'true'
- name: Setup .NET ${{ 7.0 }}
uses: actions/setup-dotnet@v3
with:
global-json-file: global.json
- name: Determine semantic version
uses: dotnet/nbgv@master
id: nbgv
- name: Build
run: dotnet build ./${{ github.event.repository.name }}.sln -c Release -p:ContinuousIntegrationBuild=true
- name: Pack
if: ${{ github.event_name == 'push' }}
run: dotnet pack ./${{ github.event.repository.name }}.sln -c Release --no-build
- name: Copy NuGet packages to artifacts
if: ${{ github.event_name == 'push' }}
uses: actions/upload-artifact@v3
with:
name: NuGetPackages
path: ./**/${{ github.event.repository.name }}.*.nupkg
if-no-files-found: error
push:
if: ${{ vars.PUSH_TO_GITHUB_PACKAGES == 'true' }}
needs: [ pack ]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: NuGetPackages
- name: Push NuGet packages to GitHub packages
run: dotnet nuget push **/${{ github.event.repository.name }}.*.nupkg
--source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
--api-key ${{ secrets.PUSH_TO_PACKAGES_PAT }}
--no-symbols
--skip-duplicate
release:
if: ${{ github.ref_name != 'main' }}
needs: [ pack ]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: NuGetPackages
- name: Draft release
id: create_release
uses: release-drafter/[email protected]
with:
name: ${{ github.event.repository.name }} ${{ needs.pack.outputs.semVer2 }}
prerelease: ${{ needs.pack.outputs.isPreviewRelease }}
tag: ${{ needs.pack.outputs.semVer2 }}
commitish: ${{ github.ref }}
env:
GITHUB_TOKEN: ${{ secrets.CREATE_RELEASE_PAT }}
- uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: '**/${{ github.event.repository.name }}.*.nupkg'
github_token: ${{ secrets.CREATE_RELEASE_PAT }}
- uses: eregon/publish-release@v1
with:
release_id: ${{ steps.create_release.outputs.id }}
env:
GITHUB_TOKEN: ${{ secrets.CREATE_RELEASE_PAT }}