PacketMediator/.gitea/workflows/release.yaml

84 lines
2.7 KiB
YAML

name: Release Rai.PacketMediator
run-name: ${{ gitea.actor }} is building the Server application
on:
push:
tags:
- 'v*.*.*'
paths-ignore:
- .run/**
jobs:
preprocess:
runs-on: ubuntu-latest
outputs:
sanitized_branch_name: ${{ steps.sanitize.outputs.sanitized_branch_name }}
steps:
- name: Sanitize branch name
id: sanitize
run: echo "::set-output name=sanitized_branch_name::$(echo ${{ github.ref_name }} | sed 's/\//-/g')"
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: https://github.com/actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Install dependencies
run: dotnet restore
- name: Build
run: |
dotnet build Rai.PacketMediator.csproj -c Release
publish:
needs: [ build ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: https://github.com/actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Install dependencies
run: dotnet restore
- name: Extract Version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "Extracted version is $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
shell: bash
- name: Pack nugets
run: |
dotnet build Rai.PacketMediator.csproj -c Release -p:PackageVersion=${{env.VERSION}}
dotnet pack -c Release -p:PackageVersion=${{env.VERSION}} --output .
- name: Push to NuGet
run: |
dotnet nuget push "*.nupkg" --api-key ${{secrets.nuget_api_key}} --source https://forge.rainote.dev/api/packages/rainote/nuget/index.json
generate-licences:
needs: [ build, preprocess ]
runs-on: ubuntu-latest
container: catthehacker/ubuntu:act-latest@sha256:a96ff9118eb7ce9aa52c46eb6989d1c0227d31ec19de3ba0d8e0a484773ab4fb
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: https://github.com/actions/setup-dotnet@v4
with:
dotnet-version: |
7.0
8.0
- name: Install dependencies
run: |
dotnet restore
echo "::add-path::$HOME/.dotnet/tools"
- name: Install nuget-license
run: dotnet tool install --global dotnet-project-licenses
- name: Export licenses
run: dotnet-project-licenses -i . -u --projects-filter projects_ignore_licenses.json -m -j -e -f licenses
- name: Upload licenses
uses: actions/upload-artifact@v3
with:
name: licenses
path: licenses
retention-days: 31