Skip to content

publish

publish #19

Workflow file for this run

name: publish
on:
workflow_dispatch:
inputs:
release_notes:
required: true
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: [ '6.0.x' ]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get version
run: echo "APP_VERSION=`git describe --tags --abbrev=0`" >> $GITHUB_ENV
- name: Setup .NET Core SDK ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v2
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --no-restore --verbosity normal
- name: Publish Windows
run: dotnet publish ./src/DatabaseBenchmark/DatabaseBenchmark.csproj --no-restore -c Release -r win-x64 --self-contained true
- name: Publish Linux
run: dotnet publish ./src/DatabaseBenchmark/DatabaseBenchmark.csproj --no-restore -c Release -r linux-x64 --self-contained true
- name: Publish OSX
run: dotnet publish ./src/DatabaseBenchmark/DatabaseBenchmark.csproj --no-restore -c Release -r osx-x64 --self-contained true
- name: Archive artifacts
run: |
zip DatabaseBenchmark-${{ env.APP_VERSION }}-win-x64.zip ./src/DatabaseBenchmark/bin/Release/net6.0/win-x64/publish/* -j
zip DatabaseBenchmark-${{ env.APP_VERSION }}-linux-x64.zip ./src/DatabaseBenchmark/bin/Release/net6.0/linux-x64/publish/* -j
zip DatabaseBenchmark-${{ env.APP_VERSION }}-osx-x64.zip ./src/DatabaseBenchmark/bin/Release/net6.0/osx-x64/publish/* -j
- name: Create Draft Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.APP_VERSION }}
release_name: ${{ env.APP_VERSION }}
body: ${{ github.event.inputs.release_notes }}
draft: true
prerelease: false
- name: Upload Windows Artifact
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./DatabaseBenchmark-${{ env.APP_VERSION }}-win-x64.zip
asset_name: DatabaseBenchmark-${{ env.APP_VERSION }}-win-x64.zip
asset_content_type: application/zip
- name: Upload Linux Artifact
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./DatabaseBenchmark-${{ env.APP_VERSION }}-linux-x64.zip
asset_name: DatabaseBenchmark-${{ env.APP_VERSION }}-linux-x64.zip
asset_content_type: application/zip
- name: Upload OSX Artifact
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./DatabaseBenchmark-${{ env.APP_VERSION }}-osx-x64.zip
asset_name: DatabaseBenchmark-${{ env.APP_VERSION }}-osx-x64.zip
asset_content_type: application/zip
- name: Publish Release
uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.create_release.outputs.id }}