Skip to content

Commit 2faaa7a

Browse files
authored
Optimize publish workflow (#43)
* Test tags * Better * Or release
1 parent 24b5226 commit 2faaa7a

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

.github/workflows/cicd.yaml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
name: cicd
44
on:
55
push:
6-
release:
7-
types: [created]
86

97
env:
108
PYTHON_VERSION: "3.10"
@@ -69,7 +67,7 @@ jobs:
6967
# Run integration tests against the API (only on the main branch, though). The comprehensive
7068
# version runs a matrix of python versions for better coverage.
7169
test-comprehensive:
72-
if: github.ref == 'refs/heads/main' || github.event_name == 'release'
70+
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
7371
needs:
7472
- test-simple
7573
runs-on: ubuntu-latest
@@ -123,10 +121,10 @@ jobs:
123121
# This is associated with the "sdk-test-prod" user, credentials on 1password
124122
GROUNDLIGHT_API_TOKEN: ${{ secrets.GROUNDLIGHT_API_TOKEN_PROD }}
125123

126-
# Run the auto-formatter when we're not on the main branch. This will push a new commit to the PR
127-
# branch if needed.
124+
# Run the auto-formatter when we're not on the main branch or creating a release. This will push a
125+
# new commit to the PR branch if needed.
128126
format:
129-
if: github.ref != 'refs/heads/main' && github.event_name != 'release'
127+
if: startsWith(github.ref, 'refs/heads/') && github.ref != 'refs/heads/main'
130128
runs-on: ubuntu-latest
131129
steps:
132130
- name: get code
@@ -169,7 +167,7 @@ jobs:
169167
# TODO: We'd like to build on pushes on any branch when docs/** changes. But then only deploy if
170168
# we are on the `main` branch and docs/** has changes.
171169
deploy-docs:
172-
if: github.ref == 'refs/heads/main' || github.event_name == 'release'
170+
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
173171
needs:
174172
- test-comprehensive
175173
runs-on: ubuntu-latest
@@ -207,7 +205,7 @@ jobs:
207205
# When a release is created on github (and comprehensive tests passed), publish the groundlight
208206
# package to public pypi.
209207
publish-python-package:
210-
if: github.event_name == 'release'
208+
if: startsWith(github.ref, 'refs/tags/v')
211209
runs-on: ubuntu-latest
212210
needs:
213211
- test-comprehensive

0 commit comments

Comments
 (0)