-
Notifications
You must be signed in to change notification settings - Fork 2
82 lines (69 loc) · 2.16 KB
/
workflow.yml
File metadata and controls
82 lines (69 loc) · 2.16 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
name: Upload Python Package
on:
push:
branches:
- master
permissions:
contents: write
id-token: write
actions: write
packages: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout master branch
uses: actions/checkout@v4
with:
ref: master
fetch-depth: 0
# - name: Create and push to main
# run: |
# git checkout -b main
# git push origin main
- name: Create and push to feature branch
run: |
git checkout -b release-main
git push origin release-main
- name: Raise PR from release-main to main
uses: peter-evans/create-pull-request@v5
with:
base: main
head: release-main
title: "Automated Release PR: release-main -> main"
body: "This PR contains the automated changes for the release process."
branch: pr-release-main-to-main
- name: Checkout release branch
# run: git checkout main
run: git checkout release-main
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine python-semantic-release setuptools-scm
- name: Run semantic-release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name github-actions
git config user.email github-actions@github.com
semantic-release version
semantic-release publish
- name: Build package
run: python -m build
- name: Publish package to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload dist/*
- name: Raise PR from main to master
uses: peter-evans/create-pull-request@v5
with:
base: master
head: main
title: "Release PR: main -> master"
body: "This PR merges the changes from the main branch back into master after the release."
branch: pr-main-to-master