|
4 | 4 | push: |
5 | 5 | pull_request: |
6 | 6 |
|
| 7 | +permissions: |
| 8 | + contents: read |
| 9 | + |
7 | 10 | jobs: |
8 | 11 | build: |
9 | 12 | runs-on: windows-latest |
|
23 | 26 | vcpkg_triplet: x86-windows |
24 | 27 | steps: |
25 | 28 | - uses: actions/checkout@v4 |
| 29 | + with: |
| 30 | + persist-credentials: false |
26 | 31 | - name: Cache vcpkg |
27 | 32 | uses: actions/cache@v4 |
28 | 33 | with: |
@@ -128,22 +133,26 @@ jobs: |
128 | 133 | name: OpenFodder-${{ matrix.arch }}-${{ matrix.configuration }}-latest |
129 | 134 | path: OpenFodder-${{ matrix.arch }}-${{ matrix.configuration }}-latest.zip |
130 | 135 | - name: Configure AWS credentials |
| 136 | + if: github.event_name == 'push' && github.ref == 'refs/heads/master' |
131 | 137 | uses: aws-actions/configure-aws-credentials@v4 |
132 | 138 | with: |
133 | 139 | aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
134 | 140 | aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
135 | 141 | aws-region: ${{ secrets.AWS_REGION || 'us-east-1' }} |
136 | 142 | - name: Upload build zip to S3 |
| 143 | + if: github.event_name == 'push' && github.ref == 'refs/heads/master' |
137 | 144 | shell: pwsh |
138 | 145 | run: | |
139 | 146 | $zipName = "OpenFodder-${{ matrix.arch }}-${{ matrix.configuration }}-latest.zip" |
140 | 147 | aws s3 cp "$zipName" "s3://openfodder-builds/$zipName" --acl public-read |
141 | 148 | - name: Discord notification |
142 | | - if: always() && env.DISCORD_WEBHOOK_URL != '' |
| 149 | + if: always() && github.event_name == 'push' && github.ref == 'refs/heads/master' |
143 | 150 | shell: pwsh |
144 | 151 | env: |
145 | 152 | DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} |
146 | 153 | run: | |
| 154 | + if ([string]::IsNullOrWhiteSpace($env:DISCORD_WEBHOOK_URL)) { exit 0 } |
| 155 | +
|
147 | 156 | $status = if ("${{ job.status }}" -eq "success") { "Success" } else { "Failure" } |
148 | 157 | $color = if ("${{ job.status }}" -eq "success") { 3066993 } else { 15158332 } |
149 | 158 | $title = "OpenFodder Windows build $status (${{ matrix.arch }})" |
|
0 commit comments