Merge pull request #1 from krogenth/shock-osc-test #3
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
name: Release Job | |
on: | |
push: | |
branches: [ main ] | |
concurrency: release | |
env: | |
SOLUTION_FILE_PATH: . | |
BASE_VERSION: 0.1 | |
RELEASE_DIRECTORY: "release_output" | |
PUBLISH_DIRECTORY: "publish" | |
jobs: | |
tag: | |
name: Create Release Tag | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get Version Info | |
id: version_info | |
run: | | |
echo "build_version=${{ env.BASE_VERSION }}.${{ github.run_number }}" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Create Tag | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: 'refs/tags/${{ steps.version_info.outputs.build_version }}', | |
sha: context.sha | |
}) | |
release: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
dotnet-version: [ '8.0.x' ] | |
configuration: [ Release ] | |
os: [ windows-latest ] | |
include: | |
- os: windows-latest | |
OS_NAME: Windows x64 | |
DOTNET_RUNTIME_IDENTIFIER: win-x64 | |
RELEASE_ZIP_OS_NAME: win_x64 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET Core SDK ${{ matrix.dotnet-version }} | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ matrix.dotnet-version }} | |
- name: Get Version Info | |
id: version_info | |
run: | | |
echo "build_version=${{ env.BASE_VERSION }}.${{ github.run_number }}" >> $GITHUB_OUTPUT | |
echo "git_short_hash=$(git rev-parse --short "${{ github.sha }}")" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Create Output Directory | |
run: "mkdir ${{ env.RELEASE_DIRECTORY }}" | |
- name: Run Publish | |
run: | | |
dotnet publish -c Release -r "${{ matrix.DOTNET_RUNTIME_IDENTIFIER }}" -o ./${{ env.PUBLISH_DIRECTORY }} -p:Version="${{ steps.version_info.outputs.build_version }}" -p:SourceRevisionId="${{ steps.version_info.outputs.git_short_hash }}" -p:DebugType=embedded OpenShock.VoiceRecognizer --self-contained | |
- name: Pack Windows Build | |
if : matrix.os == 'windows-latest' | |
run: | | |
7z a ./${{ env.RELEASE_DIRECTORY }}/OpenShock.VoiceRecognizer-${{ steps.version_info.outputs.build_version }}-win_x64.zip ./${{ env.PUBLISH_DIRECTORY }} | |
shell: bash | |
- name: Push Release | |
uses: ncipollo/release-action@v1 | |
with: | |
name: ${{ steps.version_info.outputs.build_version }} | |
artifacts: "${{ env.RELEASE_DIRECTORY }}/*.tar.gz,${{ env.RELEASE_DIRECTORY }}/*.zip" | |
tag: ${{ steps.version_info.outputs.build_version }} | |
allowUpdates: true | |
omitBodyDuringUpdate: true | |
replacesArtifacts: true |