Skip to content

BitMono.CLI.Release

BitMono.CLI.Release #4

name: BitMono.CLI.Release
on:
create:
tags:
- "*"
jobs:
Build:
if: github.event_name == 'create' && github.event.ref_type == 'tag'
runs-on: ubuntu-latest
strategy:
matrix:
target-framework: [net8.0, net7.0, net6.0, net462, netstandard2.1, netstandard2.0]
runtime: [linux-x64, win-x64]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Build Project
uses: ./.github/actions/project-build
id: project-build
with:
project_path: src/BitMono.CLI
create_artifacts: true
nuget_push: false
target_framework: ${{ matrix.target-framework }}
runtime_version: ${{ matrix.runtime }}
github_token: ${{ secrets.PAT }}
- name: Install zip
run: sudo apt-get install zip
- name: Zip artifacts
run: "cd ./src/BitMono.CLI/bin/Release/${{ matrix.target-framework }}/${{ matrix.runtime }} && zip -qq -r ./release.zip *"
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: build
path: "./src/BitMono.CLI/BitMono-v${{ github.ref_name }}-CLI-${{ matrix.target-framework }}-${{ matrix.runtime }}/BitMono-v${{ github.ref_name }}-CLI-${{ matrix.target-framework }}-${{ matrix.runtime }}.zip"
if-no-files-found: error
Release:
needs: [Build]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download build
uses: actions/download-artifact@v4
with:
name: build
path: ./build/
- name: Create version
id: get-version
run: echo "version=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_OUTPUT
shell: bash
- name: Check Prerelease
id: check-prerelease
run: "if ${{ contains(steps.get-version.outputs.version, '-') }}; then
echo is_prerelease=true >> $GITHUB_OUTPUT;
else
echo is_prerelease=false >> $GITHUB_OUTPUT;
fi"
shell: bash
- name: Create Release
uses: ncipollo/release-action@v1.14.0
with:
name: BitMono Release v${{ steps.get-version.outputs.version }}
tag: v${{ steps.get-version.outputs.version }}
artifacts: "./build/BitMono-v${{ github.ref_name }}-CLI-${{ matrix.target-framework }}-${{ matrix.runtime }}/BitMono-v${{ github.ref_name }}-CLI-${{ matrix.target-framework }}-${{ matrix.runtime }}.zip"
token: ${{ secrets.PAT }}
prerelease: ${{ steps.check-prerelease.outputs.is_prerelease }}
allowUpdates: true
generateReleaseNotes: true