Skip to content

Commit

Permalink
Optimize publish workflow (#43)
Browse files Browse the repository at this point in the history
* Test tags

* Better

* Or release
  • Loading branch information
mjvogelsong authored Apr 14, 2023
1 parent 24b5226 commit 2faaa7a
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
name: cicd
on:
push:
release:
types: [created]

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

# Run the auto-formatter when we're not on the main branch. This will push a new commit to the PR
# branch if needed.
# Run the auto-formatter when we're not on the main branch or creating a release. This will push a
# new commit to the PR branch if needed.
format:
if: github.ref != 'refs/heads/main' && github.event_name != 'release'
if: startsWith(github.ref, 'refs/heads/') && github.ref != 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: get code
Expand Down Expand Up @@ -169,7 +167,7 @@ jobs:
# TODO: We'd like to build on pushes on any branch when docs/** changes. But then only deploy if
# we are on the `main` branch and docs/** has changes.
deploy-docs:
if: github.ref == 'refs/heads/main' || github.event_name == 'release'
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
needs:
- test-comprehensive
runs-on: ubuntu-latest
Expand Down Expand Up @@ -207,7 +205,7 @@ jobs:
# When a release is created on github (and comprehensive tests passed), publish the groundlight
# package to public pypi.
publish-python-package:
if: github.event_name == 'release'
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs:
- test-comprehensive
Expand Down

0 comments on commit 2faaa7a

Please sign in to comment.