-
Notifications
You must be signed in to change notification settings - Fork 291
54 lines (52 loc) · 1.55 KB
/
publish_to_pypi.yml
File metadata and controls
54 lines (52 loc) · 1.55 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
name: Publish to PyPI
on:
push:
paths:
- version.bzl
branches: [ main ]
workflow_dispatch:
jobs:
build-binaries:
name: Build binaries
uses: ./.github/workflows/build_binaries.yml
test:
name: Test
uses: ./.github/workflows/pyrefly.yml
pypi-publish:
name: Upload to PyPI
runs-on: ubuntu-latest
needs:
- build-binaries
- test
environment:
name: pypi
url: https://pypi.org/p/pyrefly
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Download dist
uses: actions/download-artifact@v7
with:
name: dist
path: dist
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1.13
push-tag:
name: Push version tag
runs-on: ubuntu-latest
needs: pypi-publish # Don't push a tag unless the publish job succeeds
steps:
- name: Checkout repo
uses: actions/checkout@v6
with:
fetch-depth: 0 # Get all history for all branches and tags
- name: Get version
run: |
# setting to variable is necessary so sed failures will be red
VERSION=$(sed -n -e 's/^VERSION = "\(.*\)"/\1/p' version.bzl)
echo "PYREFLY_VERSION=$VERSION" >> $GITHUB_ENV
- name: Tag commit
run: git tag ${{ env.PYREFLY_VERSION }}
- name: Push tag
run: git push origin tag ${{ env.PYREFLY_VERSION }}