Attempt: Fix tagging #10
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: .NET Core Desktop | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: windows-latest # For a list of available runner types, refer to | |
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
# Install the .NET Core workload | |
- name: Install .NET Core | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild | |
- name: Setup MSBuild.exe | |
uses: microsoft/[email protected] | |
- name: Build and Publish | |
shell: pwsh | |
run: | | |
cd ./NEXImageControlPanel | |
dotnet publish -o ./dist | |
cd ./dist | |
7z a ../../distro.zip . | |
cd .. | |
- name: Set Dist Version | |
run: | | |
BUILD_NUMBER="${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" | |
echo "${BUILD_NUMBER}" | |
VERSION="$(mvn -q -U -Dexpression=project.build.finalName help:evaluate -DforceStdout=true -DbuildNumber=${BUILD_NUMBER})" | |
echo "DIST_VERSION=${VERSION}" >> $GITHUB_ENV | |
- name: Create Tag | |
id: create_tag_out | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const {DIST_VERSION} = process.env | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: `refs/tags/${DIST_VERSION}`, | |
sha: context.sha | |
}) | |
return DIST_VERSION | |
result-encoding: string | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
tag_name: ${{ steps.create_tag_out.outputs.result }} | |
release_name: Release ${{ steps.create_tag_out.outputs.result }} for ${{ github.sha }} | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ./distro.zip | |
asset_name: distro.zip | |
asset_content_type: application/zip |