Skip to content

Commit

Permalink
Separate tests from release in CI
Browse files Browse the repository at this point in the history
And make release a manual job

Signed-off-by: Carlo Lobrano <[email protected]>
  • Loading branch information
clobrano committed Jul 27, 2024
1 parent 52c1512 commit 4db7cd1
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 38 deletions.
42 changes: 4 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
name: Lestdo CI/CD
name: CI

on:
push:
branches:
- release
- main
- tags
pull_request:
workflow_dispatch:

jobs:
build:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.12'

Expand All @@ -32,36 +31,3 @@ jobs:
PYTHONPATH: ./src
run: |
pytest
release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: build

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.12'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install 'build[virtualenv]'
- name: Build package
run: |
python -m build
- name: Publish package to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m pip install --upgrade twine
python -m twine upload dist/*
43 changes: 43 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CD
on:
workflow_dispatch:
inputs:
version:
description: "The version to release, without the leading `v`"
required: true

permissions:
contents: write

jobs:
release:
runs-on: ubuntu-latest
needs: build

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install 'build[virtualenv]'
- name: Build package
run: |
python -m build
- name: Publish package to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m pip install --upgrade twine
python -m twine upload dist/*

0 comments on commit 4db7cd1

Please sign in to comment.