tidy: visuals #96
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 uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: MSBuild | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
# Path to the solution file relative to the root of the project. | |
SOLUTION_FILE_PATH: . | |
# Configuration type to build. | |
# You can convert this to a build matrix if you need coverage of multiple configuration types. | |
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
BUILD_CONFIGURATION: Release | |
permissions: | |
contents: read | |
jobs: | |
build: | |
permissions: write-all # for creating release | |
runs-on: windows-latest | |
steps: | |
- name: date | |
# run: echo "_code_date=${{ github.event.repository.updated_at}}" >> ${GITHUB_ENV} | |
run: echo "_date=$($(Get-Date -format "o").Substring(0, 10))" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- uses: actions/checkout@v3 | |
- name: Add MSBuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
- name: Build | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
# Add additional options to the MSBuild command line here (like platform or verbosity level). | |
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference | |
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}} | |
- name: version | |
run: Get-FileHash ${{ env.SOLUTION_FILE_PATH }}\x64\${{ env.BUILD_CONFIGURATION }}\dropship.exe -Algorithm SHA512 | Select-Object -ExpandProperty Hash | Out-File ${{ env.SOLUTION_FILE_PATH }}\x64\${{ env.BUILD_CONFIGURATION }}\version.txt | |
# Create the release: https://github.com/actions/create-release | |
- 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: | |
# TODO use short commit sha ?? | |
tag_name: v${{ github.run_number }} | |
release_name: dropship ${{ env._date }} | |
draft: false | |
prerelease: false | |
body: | | |
NOTES | |
- version `${{ github.run_number }}` | |
- code `${{ github.ref }}` | |
- date `${{ env._date }}` | |
# body_path: | |
# https://github.com/actions/create-release#outputs | |
# Upload release asset: https://github.com/actions/upload-release-asset | |
- name: Update 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 | |
# hardcoded path | |
asset_path: ${{ env.SOLUTION_FILE_PATH }}\x64\${{ env.BUILD_CONFIGURATION }}\dropship.exe | |
asset_name: dropship.exe | |
asset_content_type: application/octet-stream | |
- name: update version | |
id: upload-version | |
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 | |
# hardcoded path | |
asset_path: ${{ env.SOLUTION_FILE_PATH }}\x64\${{ env.BUILD_CONFIGURATION }}\version.txt | |
asset_name: version.txt | |
asset_content_type: text/plain |