Merge pull request #59 from fabulous-dev/fabulous-pre6 #27
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: ['[0-9]+.[0-9]+.[0-9]+', '[0-9]+.[0-9]+.[0-9]+-pre[0-9]+'] | |
paths-ignore: [ 'docs/**' ] | |
permissions: write-all | |
env: | |
CONFIG: Release | |
SLN_FILE: Fabulous.MauiControls.NoSamples.sln | |
TEMPLATE_PROJ: templates/Fabulous.MauiControls.Templates.proj | |
XCODE_PATH: /Applications/Xcode_15.0.1.app/Contents/Developer | |
jobs: | |
release: | |
runs-on: macos-13 | |
environment: nuget | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Extract version from tag | |
uses: damienaicheh/[email protected] | |
- name: Set release version | |
run: | | |
if [ "${PRE_RELEASE}" == "" ]; then | |
RELEASE_VERSION=${MAJOR}.${MINOR}.${PATCH} | |
else | |
RELEASE_VERSION=${MAJOR}.${MINOR}.${PATCH}-${PRE_RELEASE} | |
fi | |
echo "Release version is $RELEASE_VERSION" | |
echo "RELEASE_VERSION=$RELEASE_VERSION" >> "$GITHUB_ENV" | |
- name: Get Changelog Entry | |
id: changelog_reader | |
uses: mindsers/changelog-reader-action@v2 | |
with: | |
validation_level: warn | |
version: '${{ env.RELEASE_VERSION }}' | |
path: ./CHANGELOG.md | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.x | |
- name: Use correct Xcode version | |
run: sudo xcode-select -s ${XCODE_PATH} | |
- name: Install dotnet workload | |
run: dotnet workload install maui | |
- name: Restore | |
run: dotnet restore ${SLN_FILE} | |
- name: Build | |
run: dotnet build ${SLN_FILE} -p:Version=${RELEASE_VERSION} -c ${CONFIG} --no-restore | |
- name: Test | |
run: dotnet test ${SLN_FILE} -p:Version=${RELEASE_VERSION} -c ${CONFIG} --no-build | |
- name: Pack | |
run: | | |
find templates -type f -name template.json | xargs sed -i bak "s/PKG_VERSION/${RELEASE_VERSION}/g" | |
dotnet pack ${SLN_FILE} -p:Version=${RELEASE_VERSION} -p:PackageReleaseNotes="${{ steps.changelog_reader.outputs.changes }}" -c ${CONFIG} --no-build --property PackageOutputPath=${PWD}/nupkgs | |
dotnet pack ${TEMPLATE_PROJ} -p:Version=${RELEASE_VERSION} -c ${CONFIG} --property PackageOutputPath=${PWD}/nupkgs | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Packages | |
path: nupkgs/ | |
- name: Push | |
run: dotnet nuget push "nupkgs/*" -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_TOKEN }} --skip-duplicate |