This repository has been archived by the owner on Sep 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
96 lines (84 loc) · 2.57 KB
/
publish.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Build and Publish lm-buddy
on:
push:
tags:
- "v*"
pull_request:
branches:
- "main"
- "dev"
- "release/v[0-9].[0-9]"
workflow_dispatch:
jobs:
build_dist:
name: Build distribution 📦
runs-on: ubuntu-latest
outputs:
DISTS: ${{ steps.dists.outputs.artifact-id }}
steps:
- uses: actions/checkout@v4
- name: set up python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: set up poetry
id: setup
run: |
export VENV_PATH="$HOME/venv"
python3 -m venv $VENV_PATH
source "$VENV_PATH/bin/activate"
pip install -U pip setuptools
pip install poetry
poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry build
- name: Archive Production Artifact
uses: actions/upload-artifact@v4
id: dists
with:
name: dist
path: dist/
retention-days: 1
- name: Publish dist to test pypi
env:
POETRY_PYPI_TOKEN_TESTPYPI: ${{ secrets.PYPI_TEST_KEY }}
if: ${{ github.event_name == 'pull_request' }}
run: |
source "$HOME/venv/bin/activate"
cd $GITHUB_WORKSPACE
echo "$GITHUB_WORKSPACE"
which poetry
poetry publish --repository testpypi
- name: Publish dist to real pypi
env:
POETRY_PYPI_TOKEN: ${{ secrets.PYPI_KEY }}
if: endsWith(github.event.base_ref, 'main') == true
run: |
source "$HOME/venv/bin/activate"
poetry publish
github-release:
name: prepare release
needs:
- build_dist
runs-on: ubuntu-latest
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore
# should only run when commits are pushed to main and a tag is there (from above)
steps:
- name: download artifacts
uses: actions/download-artifact@v4
with:
name: dists
path: ./dist/
merge-multiple: true
- name: Release Draft
uses: softprops/action-gh-release@v1
with:
files: ./dist/*
draft: true
- name: Release
uses: softprops/action-gh-release@v1
if: endsWith(github.event.base_ref, 'main') == true
with:
files: ./dist/*
draft: true