Skip to content

fix(AC0011): resolve missing SymbolKind members to an unknown kind in… #276

fix(AC0011): resolve missing SymbolKind members to an unknown kind in…

fix(AC0011): resolve missing SymbolKind members to an unknown kind in… #276

name: Build and Release
# Release channels:
# Alpha - manual workflow_dispatch on main (1.0.0-alpha.1, 1.0.0-alpha.2, ...)
# Beta - manual workflow_dispatch on release/* (1.0.0-beta.1, 1.0.0-beta.2, ...)
# Stable - auto on tag push v* (1.0.0)
on:
push:
branches:
- main
- "release/**"
paths:
- "src/**"
- "**/*.sln"
- "**/*.csproj"
- "**/*.props"
- "**/*.targets"
- "Directory.Packages.props"
- "Directory.Build.props"
- "global.json"
- "nuget.config"
- "GitVersion.yml"
- ".config/dotnet-tools.json"
- ".github/workflows/**"
- ".github/actions/**"
- "!**/*.md"
tags:
- "v*"
- "!v*-*" # Exclude prerelease tags; beta tags are created inside the workflow via GITHUB_TOKEN
workflow_dispatch:
permissions:
contents: write
packages: write
pull-requests: read
jobs:
build-and-test:
uses: ./.github/workflows/build-test.yml
permissions:
contents: read
actions: read
checks: write
with:
draft-check: false
publish-report: true
release:
needs: build-and-test
runs-on: ubuntu-latest
name: Release
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
if: >-
(github.event_name == 'workflow_dispatch' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')))
|| (startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-'))
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Setup .NET SDK
uses: actions/setup-dotnet@v6
with:
dotnet-version: 10.0.x
- name: Setup BC DevTools (v${{ needs.build-and-test.outputs.tfm-netstandard21-version-lowest }})
uses: ./.github/actions/setup-bc-devtools
with:
sources: ${{ needs.build-and-test.outputs.bc-devtools-sources }}
version-number: ${{ needs.build-and-test.outputs.tfm-netstandard21-version-lowest }}
target-path: Microsoft.Dynamics.BusinessCentral.Development.Tools/netstandard2.1
- name: Setup BC DevTools (v${{ needs.build-and-test.outputs.tfm-net80-version-lowest }})
uses: ./.github/actions/setup-bc-devtools
with:
sources: ${{ needs.build-and-test.outputs.bc-devtools-sources }}
version-number: ${{ needs.build-and-test.outputs.tfm-net80-version-lowest }}
target-path: Microsoft.Dynamics.BusinessCentral.Development.Tools/net8.0
tfm: net8.0
- name: Setup BC DevTools (v${{ needs.build-and-test.outputs.tfm-net100-version-lowest }})
uses: ./.github/actions/setup-bc-devtools
with:
sources: ${{ needs.build-and-test.outputs.bc-devtools-sources }}
version-number: ${{ needs.build-and-test.outputs.tfm-net100-version-lowest }}
target-path: Microsoft.Dynamics.BusinessCentral.Development.Tools/net10.0
tfm: net10.0
# GitVersion
- name: GitVersion - Setup
uses: gittools/actions/gitversion/setup@v4.7.0
with:
versionSpec: "6.3.x"
- name: GitVersion - Determine
id: gitversion
uses: gittools/actions/gitversion/execute@v4.7.0
- name: Display version
run: echo "SemVer:${{ steps.gitversion.outputs.SemVer }}"
# Tag beta releases for sequential numbering (beta.1, beta.2, ...)
# ManualDeployment mode increments .N based on tags, not commits.
- name: Tag beta release
if: >-
github.event_name == 'workflow_dispatch'
&& startsWith(github.ref, 'refs/heads/release/')
run: |
TAG="v${{ steps.gitversion.outputs.SemVer }}"
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists (re-run), skipping"
else
git tag "$TAG"
git push origin "$TAG"
echo "Created tag $TAG"
fi
# Pack
- name: Pack
run: >
dotnet pack ./src/ALCops.Analyzers/ALCops.Analyzers.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 }}"
# GitHub Release (stable only, triggered by tag push)
- name: Build Changelog
id: build_changelog
if: startsWith(github.ref, 'refs/tags/v')
uses: mikepenz/release-changelog-builder-action@v6
with:
ignorePreReleases: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v3
with:
tag_name: v${{ steps.gitversion.outputs.SemVer }}
name: v${{ steps.gitversion.outputs.SemVer }}
body: ${{ steps.build_changelog.outputs.changelog }}
files: |
./artifacts/*.nupkg
# Publish packages (all channels)
- 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
# Clean up beta tags after stable release
- name: Delete beta tags
if: startsWith(github.ref, 'refs/tags/v')
run: |
VERSION="${{ steps.gitversion.outputs.MajorMinorPatch }}"
echo "Cleaning up beta tags for v${VERSION}"
for TAG in $(git tag -l "v${VERSION}-beta.*"); do
git push origin --delete "$TAG" && echo "Deleted $TAG" || echo "Failed to delete $TAG"
done