Skip to content

Commit

Permalink
update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
jegork committed Jun 4, 2024
1 parent 2bfae32 commit 4b39f7f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 49 deletions.
42 changes: 40 additions & 2 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ on:
branches: [ "main" ]

permissions:
contents: read
contents: write

jobs:
build:
check:

runs-on: ubuntu-latest

Expand All @@ -36,3 +36,41 @@ jobs:
- name: Test with pytest
run: |
poetry run pytest
build:
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
name: Set up Python 3.12
with:
python-version: '3.12'
cache: 'poetry'
- name: Install dependencies
run: |
poetry install
- name: Get version from pyproject.toml
id: get_version
run: |
VERSION=$(poetry version -s)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Check if tag exists
id: check_tag
run: |
if git rev-parse "v${{ env.VERSION }}" >/dev/null 2>&1; then
echo "tag_exists=true" >> $GITHUB_OUTPUT
else
echo "tag_exists=false" >> $GITHUB_OUTPUT
fi
- name: Create tag and release
if: steps.check_tag.outputs.tag_exists == 'false'
run: |
git tag "v${{ env.VERSION }}"
git push origin "v${{ env.VERSION }}"
gh release create "v${{ env.VERSION }}" --title "v${{ env.VERSION }}" --notes "Release version ${{ env.VERSION }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47 changes: 0 additions & 47 deletions .github/workflows/python-publish.yml

This file was deleted.

0 comments on commit 4b39f7f

Please sign in to comment.