-
Notifications
You must be signed in to change notification settings - Fork 11
70 lines (63 loc) · 1.98 KB
/
release.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
---
name: Version
on:
push:
branches:
- main
- develop
jobs:
versioning_pipeline:
environment:
name: ${{ github.ref_name }}
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set_output.outputs.version }}
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Setup package.json
run: |
echo '{"name":"demo", "devDependencies":{"@semantic-release/github":"9.0.4","@semantic-release/exec":"6.0.3","semantic-release":"21.0.7"}}' > package.json
- name: Install semantic-release
run: |
npm install
- name: Run semantic-release
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npx semantic-release
# Extract the version from the new git tag
NEW_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV
- name: Set version output
id: set_output
run: echo "::set-output name=version::$NEW_TAG"
pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
needs: versioning_pipeline
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Build package
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Update package version
run: |
VERSION=${{ needs.versioning_pipeline.outputs.version }}
echo "Version: $VERSION"
sed -i "s/version='1.0.0',/version='$VERSION',/g" setup.py
- name: Install build
run: python -m pip install build
- name: Build dist
run: python -m build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1