Skip to content

Improved ci with auto release generation #284

Improved ci with auto release generation

Improved ci with auto release generation #284

Workflow file for this run

name: 🛠️ Building AutoCtor
on:
workflow_dispatch:
push:
branches:
- main
- feature/*
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-**"
pull_request:
branches:
- main
jobs:
test:
name: 🧪 Run tests
runs-on: ubuntu-latest
strategy:
matrix:
roslyn: ["3.11", "4.4", "4.6", "4.8", "4.10"]
steps:
- name: 🛒 Check-out code
uses: actions/checkout@v4
- name: 📐 Setup .NET Core SDK
uses: actions/setup-dotnet@v4
with:
global-json-file: src/global.json
- name: 🔍 Enable problem matchers
run: echo "::add-matcher::.github/matchers/dotnet.json"
- name: 🧪 Testing ${{ matrix.roslyn }} code
run: >
dotnet test
--configuration Release
-p:RoslynVersion=${{ matrix.roslyn }}
--logger GitHubActions
--
RunConfiguration.CollectSourceInformation=true
build:
name: 🛠️ Build
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
steps:
- name: 🛒 Check-out code
uses: actions/checkout@v4
- name: 📐 Setup .NET Core SDK
uses: actions/setup-dotnet@v4
with:
global-json-file: src/global.json
- name: 🔍 Enable problem matchers
run: echo "::add-matcher::.github/matchers/dotnet.json"
- name: 🔧 Load packages
run: dotnet restore
- name: 🛠️ Build code
run: dotnet build --configuration Release -p:Version=${{ github.ref_name }} -p:GitSha=${{ github.sha }} --no-restore
- name: 📦 Upload Artifact
uses: actions/upload-artifact@v4
with:
name: nuget
path: nugets/*.nupkg
publish:
name: 📦 Publish nuget library
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
needs: [test, build]
steps:
- name: 📦 Download Artifact
uses: actions/download-artifact@v4
with:
name: nuget
- name: ✈️ Push Nuget
run: dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate
create-release:
name: 📝 Create GitHub Release
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
needs: [test, build]
permissions:
contents: write
steps:
- name: 🛒 Check-out code
uses: actions/checkout@v4
- name: 📦 Download Artifact
uses: actions/download-artifact@v4
with:
name: nuget
- name: 📝 Generate Release Notes
run: gh release create ${{ github.ref }} --generate-notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 📦 Upload Release Asset
run: gh release upload ${{ github.ref }} *.nupkg
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}