-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (62 loc) · 2.08 KB
/
Copy pathrelease.yml
File metadata and controls
71 lines (62 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Build and Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version tag (e.g., v1.0.0)'
required: true
default: 'v1.0.0'
permissions:
contents: write
jobs:
build:
name: Build & Release
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- rid: win-x64
platform: x64
arch_name: x64
- rid: win-arm64
platform: Arm64
arch_name: arm64
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Restore NuGet Packages
run: dotnet restore src/DevOpsToolsInstaller/DevOpsToolsInstaller.csproj -r ${{ matrix.rid }}
- name: Publish Single-File Executable
run: |
dotnet publish src/DevOpsToolsInstaller/DevOpsToolsInstaller.csproj -c Release -r ${{ matrix.rid }} --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:WindowsAppSDKSelfContained=true -p:Platform=${{ matrix.platform }} -o publish_out
- name: Rename Executable
shell: pwsh
run: |
Rename-Item -Path "publish_out\DevOpsToolsInstaller.exe" -NewName "DevOpsToolsInstaller_${{ matrix.arch_name }}.exe"
- name: Determine Release Tag
id: get_tag
shell: bash
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "tag=${{ inputs.version }}" >> $GITHUB_OUTPUT
else
echo "tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT
fi
- name: Upload Release Asset
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.get_tag.outputs.tag }}
name: Release ${{ steps.get_tag.outputs.tag }}
files: publish_out/DevOpsToolsInstaller_${{ matrix.arch_name }}.exe
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}