Skip to content

Update main.yml to allow skipping build -nobuild #57

Update main.yml to allow skipping build -nobuild

Update main.yml to allow skipping build -nobuild #57

Workflow file for this run

name: Build and Deploy
on:
push:
branches:
- release/*
- main
workflow_dispatch: #option to manually trigger action
permissions:
contents: write
jobs:
Build:
if: "!contains(github.event.head_commit.message, 'nobuild')"
runs-on: windows-latest
outputs:
gitversion_semver: ${{ steps.gitversion.outputs.semver }}
gitversion_nugetversion: ${{ steps.gitversion.outputs.nugetversion }}
steps:
- name: Checkout codegit v
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Setup GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: Execute GitVersion
id: gitversion
uses: gittools/actions/gitversion/[email protected]
- name: Setup NuGet
uses: NuGet/[email protected]
- name: NuGet restore
run: nuget restore
- name: Build DotNet
run: dotnet build -c Release
- name: Pack Projects
run: dotnet pack --output artifacts --configuration Release /p:PackageVersion=${{ steps.gitversion.outputs.nugetversion }}
- name: Publish Build Artifacts
uses: actions/[email protected]
with:
name: nuget
path: ./artifacts/*.nupkg
retention-days: 1
overwrite: true
Deploy_GitHub_Packages:
needs: Build
runs-on: windows-latest
steps:
- name: Download a Build Artifact
uses: actions/[email protected]
with:
name: nuget
path: ./artifacts
- name: Push NuGet Packages
shell: bash
run: |
shopt -s globstar
for PACKAGE_FILE in ./artifacts/*.nupkg; do
echo "Pushing $PACKAGE_FILE"
dotnet nuget push "$PACKAGE_FILE" --api-key ${{ secrets.GHUB_PAT }} --source ${{ secrets.GROWLER_PACKAGES_JSON }}
done
Deploy_NuGet-org:
needs: Build
runs-on: windows-latest
steps:
- name: Download a Build Artifact
uses: actions/[email protected]
with:
name: nuget
path: ./artifacts
- name: Push NuGet Packages
shell: bash
run: |
shopt -s globstar
for PACKAGE_FILE in ./artifacts/*.nupkg; do
echo "Pushing $PACKAGE_FILE"
dotnet nuget push "$PACKAGE_FILE" --api-key ${{ secrets.GROWLER_NUGETORG_API_KEY }} --source "https://api.nuget.org/v3/index.json"
done
Create_Release:
needs: Build
runs-on: windows-latest
steps:
- name: Display Version number
run: echo "version ${{ needs.Build.outputs.gitversion_semver }}"
- name: Create Tag
uses: negz/create-tag@v1
with:
token: ${{ secrets.GHUB_PAT }}
version: ${{ needs.Build.outputs.gitversion_semver }}
message: ${{ needs.Build.outputs.gitversion_semver }}
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
tag: ${{ needs.Build.outputs.gitversion_semver }}
generateReleaseNotes: true