fix: semantic fixes #55
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Builds and releases a new public version of C# evitaDB driver a puts it into `Releases` section of GitHub | |
name: Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: ["master"] | |
permissions: | |
contents: read | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
build-and-release: | |
name: Build and release | |
permissions: | |
# write permission is required to create a github release | |
contents: write | |
# write permission is required for autolabeler | |
# otherwise, read permission is required at least | |
pull-requests: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
timeout-minutes: 60 # Set the timeout to 60 minutes for this job | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} | |
fetch-depth: 0 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '7.0.X' # setup dotnet 7 | |
- name: Restore solution | |
run: dotnet restore ./EvitaDB.sln | |
- name: Build solution | |
run: dotnet build ./EvitaDB.sln --configuration Release --no-restore | |
- name: Run tests | |
run: dotnet test ./EvitaDB.sln --configuration Release --no-build | |
- name: Resolve new release version | |
id: release_version | |
uses: codacy/[email protected] | |
with: | |
prefix: 'v' | |
minor-identifier: 'feat' | |
major-identifier: '(breaking)' # this should be placed somewhere in the commit message like "feat: (breaking) some message" | |
- name: Build query validator | |
run: | | |
cd EvitaDB.QueryValidator | |
dotnet publish -r linux-x64 -c Release -p:PublishSingleFile=true --self-contained false | |
dotnet publish -r win-x64 -c Release -p:PublishSingleFile=true --self-contained false | |
- name: Zip | |
uses: vimtor/action-zip@v1 | |
with: | |
dest: 'Validator.zip' | |
files: 'EvitaDB.QueryValidator/bin/Release/net7.0/linux-x64/publish/Validator' | |
recursive: true | |
- name: Zip | |
uses: vimtor/action-zip@v1 | |
with: | |
dest: 'Validator-win.zip' | |
files: 'EvitaDB.QueryValidator/bin/Release/net7.0/win-x64/publish/Validator.exe' | |
recursive: true | |
- name: Pack nuget | |
env: | |
NUGET_VERSION: $( echo ${{ steps.release_version.outputs.version }} | sed 's/^v//') | |
run: | | |
export CURRENT_VERSION="${{ steps.release_version.outputs.version }}" | |
export NEW_VERSION="$( echo ${CURRENT_VERSION} | sed 's/^v//')" | |
cd EvitaDB.Client | |
dotnet pack -c Release -p:PackageVersion="${NEW_VERSION}" --no-build --no-restore | |
- name: Create release | |
id: create_release | |
uses: release-drafter/release-drafter@v5 | |
with: | |
version: ${{ steps.release_version.outputs.version }} | |
publish: true | |
- name: Upload Validator.zip to release | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./Validator.zip | |
asset_name: Validator.zip | |
asset_content_type: application/zip | |
- name: Upload Validator-win.zip to release | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./Validator-win.zip | |
asset_name: Validator-win.zip | |
asset_content_type: application/gzip | |
- name: Publish nuget | |
run: | | |
export CURRENT_VERSION="${{ steps.release_version.outputs.version }}" | |
export NEW_VERSION="$( echo ${CURRENT_VERSION} | sed 's/^v//')" | |
cd EvitaDB.Client/bin/Release | |
dotnet nuget push EvitaDB.Client."${NEW_VERSION}".nupkg --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json |