Skip to content

truncate

truncate #346

Workflow file for this run

name: Build
on:
push:
branches: [master]
pull_request:
branches: [master]
permissions: write-all
jobs:
build-windows:
runs-on: windows-2022
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@v2
id: cache
with:
path: packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
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@v2
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/[email protected]
if: github.event_name == 'pull_request'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const filename = "Build/_build/TestResult.html";
const contents = fs.readFileSync(filename, "utf8");
const { issue: { number: issue_number }, repo: { owner, repo } } = context;
github.issues.createComment({ issue_number, owner, repo, body: contents });
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.new_tag }}
release_name: Release v${{ steps.tag.outputs.new_tag }}
draft: false
prerelease: ${{ github.event_name == 'pull_request' }}
- name: Upload artifact
id: upload-artifact
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: _install\${{ env.BUILD_VERSION }}.zip
asset_name: ${{ env.BUILD_VERSION }}.zip
asset_content_type: application/zip