Skip to content

Commit

Permalink
Create publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
6bee committed Oct 31, 2023
1 parent d499528 commit 8b31a8f
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Publish

on:
push:
tags:
- v*

jobs:
build:
runs-on: windows-latest

steps:
- name: Extract version from tag
uses: nowsprinting/check-version-format-action@v3
id: version
with:
prefix: 'v'

- name: Invalid version tag
if: steps.version.outputs.is_valid != 'true'
run: |
echo "Version tag format invalid: ${{ steps.version.outputs.full }}"
exit 1
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # Mandatory to use exact version from tag action

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

- name: Check version
# assert version match with project version so only pre-release label can be changed based on release tag
run: dotnet build -t:CheckVersion -c Release -p BuildVersion="${{ steps.version.outputs.major_without_prefix }}.${{ steps.version.outputs.minor }}.${{ steps.version.outputs.patch }}"

- name: Set version info
run: |
$VersionPrefix="${{ steps.version.outputs.major_without_prefix }}.${{ steps.version.outputs.minor }}.${{ steps.version.outputs.patch }}"
$VersionSuffix="${{ steps.version.outputs.prerelease }}"
$IsStable="${{ steps.version.outputs.is_stable }}"
if ( -not $VersionSuffix ) {
$Version=$VersionPrefix
} else {
$Version="$VersionPrefix-$VersionSuffix"
}
echo "VersionPrefix=$VersionPrefix" >> $Env:GITHUB_ENV
echo "VersionSuffix=$VersionSuffix" >> $Env:GITHUB_ENV
echo "Version=$Version" >> $Env:GITHUB_ENV
echo "IsStable=$IsStable" >> $Env:GITHUB_ENV
echo "Create release: v$Version"
- name: Build
run: dotnet build aqua.tool.Validation -c Release /bl

- name: Upload build log
uses: actions/upload-artifact@v3
with:
name: msbuild_log
path: msbuild.binlog
if-no-files-found: error

- name: Upload packages
uses: actions/upload-artifact@v3
with:
name: nuget_packages
path: artifacts\*.nupkg
if-no-files-found: error

- name: Publish packages
run: |
dotnet nuget push artifacts\*.nupkg -k "$CI_MYGET_KEY" -s https://www.myget.org/F/aqua/api/v3/index.json
dotnet nuget push artifacts\*.nupkg -k "$CI_NUGET_KEY" -s https://api.nuget.org/v3/index.json

0 comments on commit 8b31a8f

Please sign in to comment.