Skip to content

Commit 4e1b7d3

Browse files
committed
Update build.yml
1 parent 3bc977e commit 4e1b7d3

1 file changed

Lines changed: 16 additions & 11 deletions

File tree

.github/workflows/build.yml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,42 @@ name: StreamViewer
22

33
on:
44
push:
5+
branches:
6+
- main
7+
- dev
58
pull_request:
69
types: [ opened, ready_for_review, reopened, synchronize ]
710
release:
811
types: [ published ]
912
workflow_dispatch:
1013

1114
env:
12-
DOTNET_VERSION: 6.0.x
15+
DOTNET_VERSION: 8.0.x
1316
# Disable the .NET logo in the console output.
1417
DOTNET_NOLOGO: true
1518
# Disable the .NET first time experience to skip caching NuGet packages and speed up the build.
1619
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
1720
# Disable sending .NET CLI telemetry to Microsoft.
1821
DOTNET_CLI_TELEMETRY_OPTOUT: true
19-
# Set the build number in MinVer.
20-
MINVERBUILDMETADATA: build.${{ github.run_number }}
2122

2223
jobs:
2324
build:
2425
name: Build-${{ matrix.os }}
26+
permissions:
27+
contents: read
2528
runs-on: ${{ matrix.os }}
2629
strategy:
2730
fail-fast: false
2831
matrix:
2932
os: [ ubuntu-latest, windows-latest, macOS-latest ]
3033
steps:
3134
- name: Checkout
32-
uses: actions/checkout@v4
35+
uses: actions/checkout@v6
3336
with:
3437
fetch-depth: 0
3538

3639
- name: Setup .NET
37-
uses: actions/setup-dotnet@v4
40+
uses: actions/setup-dotnet@v5
3841
with:
3942
dotnet-version: ${{ env.DOTNET_VERSION }}
4043

@@ -48,24 +51,26 @@ jobs:
4851
run: dotnet build --configuration Release
4952

5053
- name: Publish
54+
if: github.event_name == 'release'
5155
run: dotnet publish ./StreamViewer/StreamViewer.csproj --configuration Release --output ./publish
52-
if: startsWith(github.ref, 'refs/tags/')
5356

5457
- name: Upload artifacts
55-
uses: actions/upload-artifact@v4
58+
if: github.event_name == 'release'
59+
uses: actions/upload-artifact@v7
5660
with:
5761
name: StreamViewer-${{ runner.os }}
5862
path: ./publish
59-
if: startsWith(github.ref, 'refs/tags/')
6063

6164
publish:
6265
name: Publish
66+
permissions:
67+
contents: write
6368
runs-on: ubuntu-latest
6469
needs: build
65-
if: startsWith(github.ref, 'refs/tags/')
70+
if: github.event_name == 'release'
6671
steps:
6772
- name: Download artifacts
68-
uses: actions/download-artifact@v4
73+
uses: actions/download-artifact@v8
6974

7075
- name: Print release version
7176
run: echo ${{ github.ref_name }}
@@ -77,7 +82,7 @@ jobs:
7782
7z a StreamViewer-Windows-v${{ github.ref_name }}.zip ./StreamViewer-Windows/*
7883
7984
- name: Release
80-
uses: softprops/action-gh-release@v2
85+
uses: softprops/action-gh-release@v3
8186
env:
8287
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8388
with:

0 commit comments

Comments
 (0)