Skip to content

Drop AL Language v16 support, require v17+ #8

Drop AL Language v16 support, require v17+

Drop AL Language v16 support, require v17+ #8

name: CI/CD
on:
push:
branches:
- main
- "release/**"
paths:
- "src/**"
- "tests/**"
- "**/*.sln"
- "**/*.csproj"
- "GitVersion.yml"
- ".github/workflows/**"
- "!**/*.md"
tags:
- "v*"
pull_request:
branches: [main]
permissions:
contents: write
packages: write
checks: write
jobs:
build-and-test:
uses: ./.github/workflows/build-test.yml
release:
runs-on: ubuntu-latest
name: Release
needs: build-and-test
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Setup BC DevTools
run: |
PACKAGE="microsoft.dynamics.businesscentral.development.tools.linux"
VERSION="${{ needs.build-and-test.outputs.lowest-version }}"
echo "BC DevTools version: ${VERSION} (lowest, matching test build)"
mkdir -p Microsoft.Dynamics.BusinessCentral.Development.Tools/net8.0
curl -sL "https://api.nuget.org/v3-flatcontainer/${PACKAGE}/${VERSION}/${PACKAGE}.${VERSION}.nupkg" -o /tmp/bcdevtools.nupkg
unzip -joq /tmp/bcdevtools.nupkg "tools/net8.0/any/*.dll" -d Microsoft.Dynamics.BusinessCentral.Development.Tools/net8.0/ 2>/dev/null \
|| unzip -joq /tmp/bcdevtools.nupkg "lib/net8.0/*.dll" -d Microsoft.Dynamics.BusinessCentral.Development.Tools/net8.0/
ls Microsoft.Dynamics.BusinessCentral.Development.Tools/net8.0/Microsoft.Dynamics.Nav.CodeAnalysis.dll
- name: Build
run: dotnet build --configuration Release
# Git Version
- name: GitVersion - Setup
uses: gittools/actions/gitversion/setup@v4.3.1
with:
versionSpec: "6.3.x"
- name: GitVersion - Determine
id: gitversion
uses: gittools/actions/gitversion/execute@v4.3.1
# Pack
- name: Pack
run: >
dotnet pack ./src/ALCops.Mcp/ALCops.Mcp.csproj
--configuration Release
--output ./artifacts
/p:ContinuousIntegrationBuild=true
/p:EmbedUntrackedSources=true
/p:RepositoryType=git
/p:RepositoryUrl=https://github.com/${{ github.repository }}
/p:RepositoryCommit=${{ steps.gitversion.outputs.Sha }}
/p:PackageVersion=${{ steps.gitversion.outputs.SemVer }}
/p:AssemblyVersion=${{ steps.gitversion.outputs.AssemblySemVer }}
/p:FileVersion=${{ steps.gitversion.outputs.AssemblySemFileVer }}
/p:InformationalVersion="${{ steps.gitversion.outputs.InformationalVersion }}"
# Release (only on tags)
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/v')
with:
tag_name: v${{ steps.gitversion.outputs.SemVer }}
name: v${{ steps.gitversion.outputs.SemVer }}
generate_release_notes: true
prerelease: ${{ contains(steps.gitversion.outputs.SemVer, '-') }}
files: |
./artifacts/*.nupkg
- name: Publish to GitHub Packages
run: >
dotnet nuget push "./artifacts/*.nupkg"
--no-symbols
--api-key ${{ secrets.GITHUB_TOKEN }}
--source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
--skip-duplicate
- name: Publish to NuGet.org
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
if [ -z "$NUGET_API_KEY" ]; then
echo "NUGET_API_KEY not configured"; exit 1
fi
dotnet nuget push ./artifacts/*.nupkg \
--api-key "$NUGET_API_KEY" \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate