-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (84 loc) · 2.45 KB
/
publish.yml
File metadata and controls
89 lines (84 loc) · 2.45 KB
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
name: publish
on:
push:
branches:
- main
paths:
- 'packages/**'
workflow_dispatch:
jobs:
detect-changes:
runs-on: ubuntu-latest
timeout-minutes: 3
permissions:
pull-requests: read
outputs:
core: ${{ steps.filter.outputs.core }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
core:
- 'packages/core/**'
push-git-tag:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./
timeout-minutes: 3
outputs:
tag-name: ${{ 'v' }}${{ env.GIT_TAG_VERSION }}
tag-version: ${{ env.GIT_TAG_VERSION }}
tag-exists: ${{ steps.create-tag.outputs.tag_exists }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-packages
- name: get version from `pyproject.toml`
run: |
package_version=$(grep -m 1 version pyproject.toml | grep -Ee '[0-9]+.[0-9]+.[0-9]+' -o)
echo "GIT_TAG_VERSION=$package_version" >> $GITHUB_ENV
- uses: rickstaa/action-create-tag@v1
id: create-tag
with:
tag: ${{ 'v' }}${{ env.GIT_TAG_VERSION }}
publish-release-note:
needs: push-git-tag
if: ${{ needs.push-git-tag.outputs.tag-exists == 'false' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./
timeout-minutes: 5
permissions:
contents: write
pull-requests: read
steps:
- uses: actions/checkout@v4
- uses: release-drafter/release-drafter@v6
with:
name: ${{ needs.push-git-tag.outputs.tag-name }}
tag: ${{ needs.push-git-tag.outputs.tag-name }}
version: ${{ needs.push-git-tag.outputs.tag-version }}
publish: 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-core:
needs: [detect-changes, publish-release-note]
if: ${{ needs.detect-changes.outputs.core == 'true' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./packages/core
timeout-minutes: 5
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-packages
- name: Build package
run: uv build --no-cache
- name: Publish package to PyPI
# NOTE: need to specify directory bc `dist` directory is generated at the root-level
run: uv publish --no-cache --directory ../../