Skip to content

Commit b94fad2

Browse files
authored
Update windows-build.yml
1 parent 198946e commit b94fad2

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

.github/workflows/windows-build.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
push:
55
pull_request:
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
build:
912
runs-on: windows-latest
@@ -23,6 +26,8 @@ jobs:
2326
vcpkg_triplet: x86-windows
2427
steps:
2528
- uses: actions/checkout@v4
29+
with:
30+
persist-credentials: false
2631
- name: Cache vcpkg
2732
uses: actions/cache@v4
2833
with:
@@ -128,22 +133,26 @@ jobs:
128133
name: OpenFodder-${{ matrix.arch }}-${{ matrix.configuration }}-latest
129134
path: OpenFodder-${{ matrix.arch }}-${{ matrix.configuration }}-latest.zip
130135
- name: Configure AWS credentials
136+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
131137
uses: aws-actions/configure-aws-credentials@v4
132138
with:
133139
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
134140
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
135141
aws-region: ${{ secrets.AWS_REGION || 'us-east-1' }}
136142
- name: Upload build zip to S3
143+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
137144
shell: pwsh
138145
run: |
139146
$zipName = "OpenFodder-${{ matrix.arch }}-${{ matrix.configuration }}-latest.zip"
140147
aws s3 cp "$zipName" "s3://openfodder-builds/$zipName" --acl public-read
141148
- name: Discord notification
142-
if: always() && env.DISCORD_WEBHOOK_URL != ''
149+
if: always() && github.event_name == 'push' && github.ref == 'refs/heads/master'
143150
shell: pwsh
144151
env:
145152
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
146153
run: |
154+
if ([string]::IsNullOrWhiteSpace($env:DISCORD_WEBHOOK_URL)) { exit 0 }
155+
147156
$status = if ("${{ job.status }}" -eq "success") { "Success" } else { "Failure" }
148157
$color = if ("${{ job.status }}" -eq "success") { 3066993 } else { 15158332 }
149158
$title = "OpenFodder Windows build $status (${{ matrix.arch }})"

0 commit comments

Comments
 (0)