-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (96 loc) · 5.86 KB
/
feature_pr.yml
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: PR Merge / PYPI
on:
pull_request:
types: [ closed ]
env:
ARTIFACT_BASE_NAME: mdps-ds-lib
PR_NUMBER: ${{ github.event.number }}
PR_TITLE: ${{ github.event.pull_request.title }}
GH_TOKEN: ${{ github.token }}
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
jobs:
if_merged:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Develop -- Log PR info
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop' && !(contains(github.event.pull_request.title, 'update version + change log')) && !(contains(github.event.pull_request.title, 'catchup from main'))
run: |
echo "${PR_TITLE} -- ${PR_NUMBER}"
- name: Develop -- Update setup version
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop' && !(contains(github.event.pull_request.title, 'update version + change log')) && !(contains(github.event.pull_request.title, 'catchup from main'))
run: |
python3 "${GITHUB_WORKSPACE}/.ci/update_setup_version.py" FEATURE
- name: Develop -- Run version commit script
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop' && !(contains(github.event.pull_request.title, 'update version + change log')) && !(contains(github.event.pull_request.title, 'catchup from main'))
run: |
chmod +x "${GITHUB_WORKSPACE}/.ci/update_version_commit.sh"
"${GITHUB_WORKSPACE}/.ci/update_version_commit.sh"
- name: MAIN -- Log PR info
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && (contains(github.event.pull_request.title, 'RELEASE'))
run: |
echo "${PR_TITLE} -- ${PR_NUMBER}"
- name: MAIN -- Update setup version
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && (contains(github.event.pull_request.title, 'RELEASE'))
run: |
python3 "${GITHUB_WORKSPACE}/.ci/update_setup_version.py" RELEASE
- name: MAIN -- Run version commit script
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && (contains(github.event.pull_request.title, 'RELEASE'))
run: |
chmod +x "${GITHUB_WORKSPACE}/.ci/update_version_commit.sh"
"${GITHUB_WORKSPACE}/.ci/update_version_commit.sh" main
- name: Develop -- Install dependencies
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop' && contains(github.event.pull_request.title, 'update version + change log')
run: |
python3 -m pip install poetry twine
- name: Develop -- Build the project
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop' && contains(github.event.pull_request.title, 'update version + change log')
run: |
python3 -m poetry build
- name: Develop -- Upload to PyPI
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop' && contains(github.event.pull_request.title, 'update version + change log')
run: |
python3 -m twine upload --repository pypi dist/*
- name: MAIN -- Install dependencies
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && contains(github.event.pull_request.title, 'update version + change log')
run: |
python3 -m pip install poetry twine
- name: MAIN -- Build the project
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && contains(github.event.pull_request.title, 'update version + change log')
run: |
python3 -m poetry build
- name: MAIN -- Upload to PyPI
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && contains(github.event.pull_request.title, 'update version + change log')
run: |
python3 -m twine upload --repository pypi dist/*
- name: MAIN -- Catch up PR
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && contains(github.event.pull_request.title, 'update version + change log')
run: |
chmod +x "${GITHUB_WORKSPACE}/.ci/catchup_pr.sh"
"${GITHUB_WORKSPACE}/.ci/catchup_pr.sh"
- name: MAIN -- Upload to PyPI
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && contains(github.event.pull_request.title, 'update version + change log')
run: |
# make file runnable, might not be necessary
chmod +x "${GITHUB_WORKSPACE}/.ci/store_version.sh"
"${GITHUB_WORKSPACE}/.ci/store_version.sh"
- name: MAIN -- Create Release Body
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && contains(github.event.pull_request.title, 'update version + change log')
run: |
python3 "${GITHUB_WORKSPACE}/.ci/update_setup_version.py" RELEASE_BODY
- name: MAIN -- Create Release
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && contains(github.event.pull_request.title, 'update version + change log')
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: "v${{ env.software_version }}"
release_name: "Release v${{ env.software_version }} - ${{ github.ref }}"
body_path: ./release_body.txt
draft: false
prerelease: false