Skip to content

chore(deps-dev): bump terser from 5.49.2 to 5.50.0 in the npm-minor-a… #107

chore(deps-dev): bump terser from 5.49.2 to 5.50.0 in the npm-minor-a…

chore(deps-dev): bump terser from 5.49.2 to 5.50.0 in the npm-minor-a… #107

name: Publish Prerelease
on:
push:
branches:
- main
permissions:
contents: read
env:
TESTINGPLATFORM_EXITCODE_IGNORE: 8
jobs:
tests:
uses: ./.github/workflows/build-template.yml
with:
configuration: Release
publish-prerelease:
needs: tests
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: true
submodules: recursive
- name: Check if commit has a preview release tag
id: check-tags
run: |
git fetch --tags
if git tag --points-at HEAD | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+-preview\.[0-9]+$'; then
echo "is_tagged=true" >> $GITHUB_OUTPUT
else
echo "is_tagged=false" >> $GITHUB_OUTPUT
fi
- name: Setup .NET SDKs
if: steps.check-tags.outputs.is_tagged == 'false'
uses: actions/setup-dotnet@v6
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x
11.0.100-preview.6.26359.118
- name: Setup Node.js
if: steps.check-tags.outputs.is_tagged == 'false'
uses: actions/setup-node@v7
with:
node-version: lts/*
- name: Restore WebAssembly workloads
if: steps.check-tags.outputs.is_tagged == 'false'
run: dotnet workload restore NTComponents.slnx --skip-manifest-update
- name: Restore dependencies
if: steps.check-tags.outputs.is_tagged == 'false'
run: dotnet restore NTComponents.slnx -p:SkipAotCompatibilityNativeBuild=true
- name: Install node dependencies
if: steps.check-tags.outputs.is_tagged == 'false'
run: npm ci
- name: Build TypeScript modules
if: steps.check-tags.outputs.is_tagged == 'false'
run: npm run build:ts:release
- name: Build
if: steps.check-tags.outputs.is_tagged == 'false'
run: dotnet build NTComponents.slnx --no-restore --configuration Release -p:SkipAotCompatibilityNativeBuild=true
- name: Install semantic-release
if: steps.check-tags.outputs.is_tagged == 'false'
run: |
npm install --no-save semantic-release @semantic-release/commit-analyzer @semantic-release/release-notes-generator @semantic-release/github conventional-changelog-conventionalcommits
- name: Publish preview release
if: steps.check-tags.outputs.is_tagged == 'false'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
git fetch --tags
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -B preview HEAD
git push --force origin HEAD:preview
GITHUB_REF=refs/heads/preview GITHUB_REF_NAME=preview npx semantic-release
- name: Resolve preview package version
id: release-version
if: steps.check-tags.outputs.is_tagged == 'false'
run: |
set -euo pipefail
git fetch --tags
release_tag=$(git tag --points-at HEAD | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+-preview\.[0-9]+$' | sort -V | tail -n 1 || true)
if [ -z "$release_tag" ]; then
echo "No preview release was created for this commit; skipping package publication."
echo "version=" >> $GITHUB_OUTPUT
exit 0
fi
echo "version=${release_tag#v}" >> $GITHUB_OUTPUT
- name: Validate NuGet API key
if: steps.check-tags.outputs.is_tagged == 'false' && steps.release-version.outputs.version != ''
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
if [ -z "$NUGET_API_KEY" ]; then
echo "NUGET_API_KEY secret is missing or unavailable to this workflow."
exit 1
fi
- name: Pack NuGet packages
if: steps.check-tags.outputs.is_tagged == 'false' && steps.release-version.outputs.version != ''
run: |
set -euo pipefail
rm -rf ./artifacts/nuget
mkdir -p ./artifacts/nuget
dotnet pack ./NTComponents/NTComponents.csproj --configuration Release --output ./artifacts/nuget /p:PackageVersion=${{ steps.release-version.outputs.version }}
dotnet pack ./NTComponents.AspNetCore/NTComponents.AspNetCore.csproj --configuration Release --output ./artifacts/nuget /p:PackageVersion=${{ steps.release-version.outputs.version }}
dotnet pack ./NTComponents.Extensions/NTComponents.Extensions.csproj --configuration Release --output ./artifacts/nuget /p:PackageVersion=${{ steps.release-version.outputs.version }}
dotnet pack ./NTComponents.Analyzers/NTComponents.Analyzers.csproj --configuration Release --output ./artifacts/nuget /p:PackageVersion=${{ steps.release-version.outputs.version }}
- name: Verify analyzer package
if: steps.check-tags.outputs.is_tagged == 'false' && steps.release-version.outputs.version != ''
run: pwsh ./test-analyzer-package.ps1 -PackagePath "./artifacts/nuget/NTComponents.Analyzers.${{ steps.release-version.outputs.version }}.nupkg"
- name: Publish NuGet packages
if: steps.check-tags.outputs.is_tagged == 'false' && steps.release-version.outputs.version != ''
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
dotnet nuget push ./artifacts/nuget/*.nupkg --api-key "$NUGET_API_KEY" --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Delete preview tag on failure
if: failure() && steps.check-tags.outputs.is_tagged == 'false'
run: |
set -euo pipefail
git fetch --tags
tags=$(git tag --points-at HEAD | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+-preview\.[0-9]+$' || true)
if [ -z "$tags" ]; then
echo "No preview release tag found on this commit."
exit 0
fi
for tag in $tags; do
echo "Deleting failed preview release tag $tag"
git tag -d "$tag" || true
git push origin ":refs/tags/$tag"
done