Skip to content

Merge pull request #1 from jdpnielsen/main Implement 'Save and preview' functionality #98

Merge pull request #1 from jdpnielsen/main Implement 'Save and preview' functionality

Merge pull request #1 from jdpnielsen/main Implement 'Save and preview' functionality #98

Workflow file for this run

name: CI-CD
run-name: ${{ github.event.head_commit.message || github.ref_name }}
on:
create:
branches:
- release/**
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
env:
BUILD_CONFIG: 'Release'
SOLUTION: 'Our.Umbraco.HeadlessPreview.sln'
PROJECT: 'src/Our.Umbraco.HeadlessPreview/*.csproj'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get Build Version
run: |
Import-Module .\GetBuildVersion.psm1
Write-Host $Env:GITHUB_REF
$version = GetBuildVersion -VersionString $Env:GITHUB_REF
echo "BUILD_VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
echo "BUILD_VERSION=$version" >> $GITHUB_ENV
shell: pwsh
- name: Setup NuGet
uses: NuGet/setup-nuget@v1.1.1
- name: Restore dependencies
run: nuget restore $SOLUTION
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
5.0
6.0
7.0
- name: Build
run: dotnet build $PROJECT --configuration $BUILD_CONFIG -p:Version=$BUILD_VERSION --no-restore
if: "!startsWith(github.ref, 'refs/heads/release')"
- name: Run tests
run: dotnet test --no-restore --verbosity normal
- name: Publish on nuget.org
if: startsWith(github.ref, 'refs/heads/release')
run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}}
- name: Create Github release
if: startsWith(github.ref, 'refs/heads/release')
# You may pin to the exact commit or the version.
# uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
uses: softprops/action-gh-release@v0.1.15
with:
# Note-worthy description of changes in release
#body: # optional
# Path to load note-worthy description of changes in release from
body_path: ${{ github.workspace }}/releaseNotes/${{ env.BUILD_VERSION }}.md
# Gives the release a custom name. Defaults to tag name
name: ${{ env.BUILD_VERSION }}
# Gives a tag name. Defaults to github.GITHUB_REF
tag_name: ${{ env.BUILD_VERSION }}
# Creates a draft release. Defaults to false
draft: false
# Identify the release as a prerelease. Defaults to false
prerelease: false
# Newline-delimited list of path globs for asset files to upload
files: |
**/*.nupkg
# Fails if any of the `files` globs match nothing. Defaults to false
fail_on_unmatched_files: false
# Repository to make releases against, in <owner>/<repo> format
#repository: # optional
# Authorized secret GitHub Personal Access Token. Defaults to github.token
#token: # optional, default is ${{ github.token }}
# Commitish value that determines where the Git tag is created from. Can be any branch or commit SHA.
#target_commitish: master
# If specified, a discussion of the specified category is created and linked to the release. The value must be a category that already exists in the repository. If there is already a discussion linked to the release, this parameter is ignored.
#discussion_category_name: # optional
# Whether to automatically generate the name and body for this release. If name is specified, the specified name will be used; otherwise, a name will be automatically generated. If body is specified, the body will be pre-pended to the automatically generated notes.
generate_release_notes: false
# Append to existing body instead of overwriting it. Default is false.
append_body: false