Misc changes #21
Workflow file for this run
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
# This workflow will build a .NET project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
name: .NET | |
on: | |
push: | |
tags: | |
- 'v*' | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_run: | |
workflows: | |
- "test" # basically i have another test action to run unit tests | |
types: | |
- completed | |
jobs: | |
test: | |
name: Debug Build & Test | |
runs-on: ubuntu-latest | |
env: | |
DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
NUGET_XMLDOC_MODE: skip | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 7.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build -c Debug | |
- name: Test | |
run: dotnet test -c Debug --no-build | |
create_release: | |
name: Create Github Release | |
if: contains(github.ref, 'tags/v') # works only version tagged | |
needs: [test] | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
file_name: ${{ github.repository }}-${{ github.ref }} | |
steps: | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1.0.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
publish: | |
if: contains(github.ref, 'tags/v') # works only version tagged | |
needs: [test, create_release] | |
runs-on: ubuntu-latest | |
env: | |
DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
NUGET_XMLDOC_MODE: skip | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Load Release URL File from release job | |
uses: actions/download-artifact@v1 | |
with: | |
name: release_url | |
- name: Setup .NET 7.0 (current) | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 7.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: | | |
dotnet publish -c Release -r linux-arm64 --self-contained=true -p:PublishSingleFile=true -p:GenerateRuntimeConfigurationFiles=true -o ./bin/linux-x64 | |
zip -r linux-x64 ./bin/linux-x64 | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_path: ./linux-x64.zip | |
asset_name: ${{ needs.create_release.outputs.file_name }}-linux-x64.zip | |
asset_content_type: application/zip |