Merge branch 'gateway' #364
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: Build | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
permissions: write-all | |
jobs: | |
build-windows: | |
runs-on: windows-2022 | |
concurrency: | |
group: ${{ github.workflow }}-build | |
cancel-in-progress: true | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: microsoft/[email protected] | |
- uses: nuget/setup-nuget@v1 | |
with: | |
nuget-version: '5.x' | |
# 21.44.101.0 | |
- name: Set version | |
run: | | |
$d = Get-Date -UFormat "%u" | |
$v = "{0}.{1}.{2}.{3}" -f | |
(Get-Date -UFormat "%y"), | |
(Get-Date -UFormat "%V"), | |
($d -eq "0" ? "7" : $d), | |
$env:GITHUB_RUN_NUMBER | |
echo ("BUILD_VERSION=$v") >> $env:GITHUB_ENV | |
echo $v | |
- uses: actions/cache@v4 | |
id: cache | |
with: | |
path: packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | |
restore-keys: | | |
${{ runner.os }}-nuget- | |
- name: Restore | |
#if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
nuget restore Snittlistan.sln | |
- name: Build | |
run: msbuild build.build -t:All -p:Version=$env:BUILD_VERSION -p:WIX_PATH=$env:wix -p:NUnitConsoleRunnerPath=$env:GITHUB_WORKSPACE\packages\nunit.consolerunner\3.15.0\ | |
- name: Upload a Build Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: 'Test Result' | |
path: Build\_build\TestResult.html | |
- name: Push tag | |
id: tag | |
uses: laputansoft/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ env.BUILD_VERSION }} | |
- name: Comment pull request | |
uses: actions/github-script@v7 | |
if: github.event_name == 'pull_request' | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const fs = require('fs'); | |
const filename = "Build/_build/TestResult.html"; | |
const body = fs.readFileSync(filename, "utf8"); | |
const { issue: { number: issue_number }, repo: { owner, repo } } = context; | |
github.rest.issues.createComment({ issue_number, owner, repo, body }); | |
- name: Create release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.tag.outputs.new_tag }} | |
name: Release v${{ steps.tag.outputs.new_tag }} | |
draft: false | |
prerelease: ${{ github.event_name == 'pull_request' }} | |
files: | | |
_install/${{ env.BUILD_VERSION }}.zip |