Skip to content

Commit

Permalink
moved checktag in the pypi_release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
lifeizhou-ap committed Aug 29, 2024
1 parent 79f8625 commit cd5424a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 36 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,34 +25,3 @@ jobs:
run: |
uv run pytest tests -m 'not integration'
create_tag:
runs-on: ubuntu-latest
needs: build
if: ${{ github.ref == 'refs/heads/main' }}

steps:
- uses: actions/checkout@v4

- name: Install UV
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Source Cargo Environment
run: source $HOME/.cargo/env

- name: Build with UV
run: uvx --from build pyproject-build --installer uv

- name: Check tag exists
run: |
dist_file_name=$(cd dist && ls goose-ai*.tar.gz)
./scripts/check_tag_exists.sh $dist_file_name
env:
GITHUB_ENV: $GITHUB_ENV

- name: Create tag if it doesn't exist
if: env.tag_version != ''
run: |
git tag "v$tag_version"
git push origin "v$tag_version"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27 changes: 22 additions & 5 deletions .github/workflows/pypi_release.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
name: PYPI Release

on:
push:
tags:
- 'v*'
workflow_run:
workflows: ["CI"]
types:
- completed

jobs:
pypi_release:
runs-on: ubuntu-latest

if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main' }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
ref: ${{ github.event.workflow_run.head_sha }}

- name: Install UV
run: curl -LsSf https://astral.sh/uv/install.sh | sh
Expand All @@ -23,7 +24,23 @@ jobs:
- name: Build with UV
run: uvx --from build pyproject-build --installer uv

- name: Check tag exists
run: |
dist_file_name=$(cd dist && ls goose-ai*.tar.gz)
./scripts/check_tag_exists.sh $dist_file_name
env:
GITHUB_ENV: $GITHUB_ENV

- name: Create tag if it doesn't exist
if: env.tag_version != ''
run: |
git tag "v$tag_version"
git push origin "v$tag_version"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish
if: ${{ success() }}
uses: pypa/gh-action-pypi-publish@v1.4.2
with:
user: __token__
Expand Down

0 comments on commit cd5424a

Please sign in to comment.