Skip to content

Release

Release #374

Workflow file for this run

# SPDX-FileCopyrightText: 2024 Emulsion contributors <https://github.com/codingteam/emulsion>
#
# SPDX-License-Identifier: MIT
name: Release
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
branches:
- master
schedule:
- cron: '0 0 * * 6' # every Saturday
jobs:
publish:
runs-on: ubuntu-24.04
env:
NUGET_PACKAGES: ${{ github.workspace }}/.github/nuget-packages
steps:
- name: Read version from Git ref
id: version
shell: pwsh
run: echo "version=$(if ($env:GITHUB_REF.StartsWith('refs/tags/v')) { $env:GITHUB_REF -replace '^refs/tags/v', '' } else { 'next' })" >> $env:GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v4
- name: Read the changelog
uses: ForNeVeR/ChangelogAutomation.action@v2
with:
input: ./CHANGELOG.md
output: ./changelog-section.md
- name: Upload the changelog
uses: actions/upload-artifact@v4
with:
name: changelog-section.md
path: ./changelog-section.md
- name: Set up .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: NuGet cache
uses: actions/cache@v4
with:
path: ${{ env.NUGET_PACKAGES }}
key: ${{ runner.os }}.nuget.${{ hashFiles('**/*.*proj') }}
- name: Publish
run: dotnet publish Emulsion --output publish -p:UseAppHost=false
- name: Pack
shell: pwsh
run: Compress-Archive -Path publish -DestinationPath emulsion-${{ steps.version.outputs.version }}.zip
- name: Upload the pack result
uses: actions/upload-artifact@v4
with:
name: emulsion-${{ steps.version.outputs.version }}.zip
path: emulsion-${{ steps.version.outputs.version }}.zip
- name: Create a release
if: startsWith(github.ref, 'refs/tags/v')
# noinspection SpellCheckingInspection
uses: softprops/action-gh-release@v2
with:
name: Emulsion v${{ steps.version.outputs.version }}
body_path: ./changelog-section.md
files: |
emulsion-${{ steps.version.outputs.version }}.zip