Skip to content

Commit dcb88db

Browse files
committed
gh-actions: upload to registries on merges only
1 parent 502657c commit dcb88db

File tree

1 file changed

+27
-22
lines changed

1 file changed

+27
-22
lines changed

.github/workflows/go.yml

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ jobs:
2222
with:
2323
go-version: '>=1.24'
2424

25+
- name: 🐍 Python3
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: '3.10'
29+
2530
- name: 🏗️ Make
2631
run: |
2732
# outputs firestack.aar and firestack-arm.aar; also see: "Obj" below
@@ -35,27 +40,6 @@ jobs:
3540
# go test -v -race -bench=. -benchtime=100ms ./...
3641
echo "::notice::success"
3742
38-
- name: 🔮 Vet
39-
run: |
40-
# github.com/actions/setup-go/issues/27
41-
export PATH=${PATH}:`go env GOPATH`/bin
42-
43-
# vet: fails: archive.is/XcDl6
44-
go vet ./...
45-
# staticcheck
46-
# go install honnef.co/go/tools/cmd/staticcheck@latest
47-
# staticcheck ./...
48-
go install go.uber.org/nilaway/cmd/nilaway@latest
49-
nilaway ./...
50-
go install golang.org/x/vuln/cmd/govulncheck@latest
51-
govulncheck -show verbose -test ./...
52-
shell: bash
53-
54-
- name: 🐍 Python3
55-
uses: actions/setup-python@v5
56-
with:
57-
python-version: '3.10'
58-
5943
- name: 💿 Obj
6044
run: |
6145
wget --tries=2 --waitretry=3 --no-dns-cache https://github.com/Zxilly/go-size-analyzer/releases/download/v1.0.8/go-size-analyzer_1.0.8_linux_amd64.deb -O gsa.deb
@@ -135,7 +119,24 @@ jobs:
135119
echo "====================="
136120
shell: bash
137121

122+
- name: 🔮 Vet
123+
run: |
124+
# github.com/actions/setup-go/issues/27
125+
export PATH=${PATH}:`go env GOPATH`/bin
126+
127+
# vet: fails: archive.is/XcDl6
128+
go vet ./...
129+
# staticcheck
130+
# go install honnef.co/go/tools/cmd/staticcheck@latest
131+
# staticcheck ./...
132+
go install go.uber.org/nilaway/cmd/nilaway@latest
133+
nilaway ./...
134+
go install golang.org/x/vuln/cmd/govulncheck@latest
135+
govulncheck -show verbose -test ./...
136+
shell: bash
137+
138138
- name: 🛸 Env
139+
if: success()
139140
run: |
140141
# docs.github.com/en/actions/reference/workflows-and-actions/contexts#github-context
141142
GROUP_GITHUB="com.github.${{ github.repository_owner }}"
@@ -185,6 +186,7 @@ jobs:
185186
shell: bash
186187

187188
- name: 🏷️ Setup for GitHub Packages
189+
if: success() && github.event_name == 'push'
188190
uses: actions/setup-java@v4
189191
with:
190192
java-version: '17'
@@ -193,6 +195,7 @@ jobs:
193195
# docs.github.com/en/actions/tutorials/build-and-test-code/java-with-maven
194196
# docs.github.com/en/actions/tutorials/publish-packages/publish-java-packages-with-maven#publishing-packages-to-github-packages
195197
- name: 📦 Publish
198+
if: success() && github.event_name == 'push'
196199
shell: bash
197200
run: |
198201
# uploaded at:
@@ -217,6 +220,7 @@ jobs:
217220
# github.com/slsa-framework/slsa-github-generator/blob/4876e96b8268/actions/maven/publish/action.yml#L49
218221
# docs.github.com/en/actions/tutorials/publish-packages/publish-java-packages-with-maven#publishing-packages-to-the-maven-central-repository-and-github-packages
219222
- name: 🏛️ Setup for Maven Central
223+
if: success() && github.event_name == 'push'
220224
uses: actions/setup-java@v4
221225
with:
222226
java-version: '17'
@@ -228,6 +232,7 @@ jobs:
228232
gpg-passphrase: ${{ secrets.OSSRH_CELZERO_GPG_PASSPHRASE }}
229233

230234
- name: 📦 Publish to Maven Central
235+
if: success() && github.event_name == 'push'
231236
shell: bash
232237
run: |
233238
mvn -f ${POM_OSSRH} versions:set -DnewVersion=${VCSVER} -DgenerateBackupPoms=false
@@ -260,8 +265,8 @@ jobs:
260265

261266
# github.com/actions/upload-artifact
262267
- name: 🚀 Upload
268+
if: success() && github.event_name == 'push'
263269
uses: actions/upload-artifact@v4
264-
if: success()
265270
with:
266271
name: firestack-aar-${{ github.sha }} # must be unique
267272
path: firestack*.aar # see: make-aar

0 commit comments

Comments
 (0)