Skip to content

Commit

Permalink
Feat: add CI for build and publish package
Browse files Browse the repository at this point in the history
  • Loading branch information
amelie-rondot committed Feb 9, 2024
1 parent dbfd808 commit ad3e490
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 54 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build and publish on version tag

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
build:
runs-on: ubuntu-latest

env:
TAG_VERSION: ${{ github.ref_name }}

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

- uses: actions/setup-python@v5
with:
python-version: '3.9'

- name: Build package
run: |
poetry version ${TAG_VERSION#v}
poetry build
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
retention-days: 1


publish:
runs-on: ubuntu-latest

env:
TOKEN: ${{ secrets.PYPI_TOKEN }}
PASSWORD: ${{ secrets.PYPI_PASSWORD }}
VERSION: ${{ github.ref_name }}

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

- uses: actions/setup-python@v5
with:
python-version: '3.9'

- name: Download archive
uses: actions/download-artifact@v4

- name: Config repository
run: |
poetry config pypi-token.pypi ${{ TOKEN }}
poetry config http-basic.pypi multi_coop ${{ PASSWORD }}
- name: Publish ${{ VERSION }}
run: poetry publish
54 changes: 0 additions & 54 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,57 +30,3 @@ jobs:

- name: linting
run: make lint

build:
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
runs-on: ubuntu-latest

env:
VERSION: ${{ github.ref_name }}

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

- uses: actions/setup-python@v5
with:
python-version: '3.9'

- name: Build package
run: poetry version ${{ VERSION }} && poetry build

- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
retention-days: 1


publish:
runs-on: ubuntu-latest

env:
TOKEN: ${{ secrets.PYPI_TOKEN }}
PASSWORD: ${{ secrets.PYPI_PASSWORD }}
VERSION: ${{ github.ref_name }}

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

- uses: actions/setup-python@v5
with:
python-version: '3.9'

- name: Download archive
uses: actions/download-artifact@v4

- name: Config repository
run: poetry config pypi-token.pypi ${{ TOKEN }} && poetry config http-basic.pypi multi_coop ${{ PASSWORD }}

- name: Publish ${{ VERSION }}
run: poetry publish

0 comments on commit ad3e490

Please sign in to comment.