Skip to content

πŸ”– Bump version to 0.8.12 #51

πŸ”– Bump version to 0.8.12

πŸ”– Bump version to 0.8.12 #51

name: πŸš€ On Merge to Main, create a tag from the version in csproj
on:
pull_request:
branches:
- main
types: [closed]
jobs:
tag-version:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: πŸ“₯ Checkout
uses: actions/[email protected]
- name: πŸ” Extract version from csproj
run: |
VERSION=$(cat CodeMirror6/CodeMirror6.csproj | grep '<Version>' | sed 's/<\/\?Version>//g' | xargs)
if [[ -z "$VERSION" ]]; then
echo "Version not found in .csproj file"
exit 1
fi
echo "Extracted version: $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: 🏷️ Create Tag
if: env.VERSION != ''
uses: actions/github-script@v7
with:
script: |
const version = '${{ env.VERSION }}';
if (!version) {
console.log("Version is empty, skipping tag creation.");
return;
}
const tagName = version;
const ref = 'refs/tags/' + tagName;
console.log(`Creating tag: ${tagName}`);
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: ref,
sha: context.sha
}).catch(error => {
console.error(`Failed to create tag: ${error.message}`);
core.setFailed(`Failed to create tag: ${error.message}`);
});
- name: πŸš€ Create GitHub Release
uses: softprops/action-gh-release@v1
with:
draft: false
prerelease: false
tag_name: ${{ env.REF }}
name: Release ${{ env.VERSION }}
generate_release_notes: true
body_path: NEW_CHANGELOG.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REF: refs/tags/${{ env.VERSION }}
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: πŸ“₯ Checkout
uses: actions/checkout@v3
- name: πŸ“¦ Setup NuGet
uses: NuGet/[email protected]
- name: πŸ› οΈ Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '21'
- name: πŸ› οΈ Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: πŸ“₯ Restore dependencies
run: dotnet restore $SOLUTION
- name: πŸ—οΈ Build library
run: dotnet build CodeMirror6
- name: πŸ—οΈ Build wasm app
run: dotnet build Examples.BlazorWasm
- name: πŸš€ Publish
run: |
dotnet publish Examples.BlazorWasm -c Release -o ./build
cp ./build/wwwroot/index.html ./build/wwwroot/404.html
- name: 🌍 Set base path
run: sed -i 's|<base href="/" />|<base href="/BlazorCodeMirror6/" />|g' ./build/wwwroot/index.html
- name: πŸš€ Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/wwwroot
- name: πŸ“¦ Prepare Nuget package
run: dotnet pack --configuration Release --include-symbols --include-source
- name: πŸš€ Publish to NuGet
run: dotnet nuget push "**/*.nupkg" --source "https://api.nuget.org/v3/index.json" -k ${{ secrets.NUGET_API_KEY }}