-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (125 loc) · 4.75 KB
/
build-pipeline.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
129
130
131
132
133
134
135
# When code is pushed to a branch, run linting and tests, and
# then automatically increment the version number as appropriate for the branch source.
name: Lint and Test
# Controls when the workflow will run
on:
# Triggers the workflow on push events
push:
branches: [ develop, release/**, main, feature/**, issue/**, issues/** ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
run_tests:
uses: ./.github/workflows/reusable_run_tests.yml
bump_version:
needs: run_tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.3.2
- name: Get version
id: get-version
run: |
echo "current_version=$(poetry version | awk '{print $2}')" >> $GITHUB_OUTPUT
echo "pyproject_name=$(poetry version | awk '{print $1}')" >> $GITHUB_ENV
# - name: Bump pre-alpha version
# # If triggered by push to a feature branch
# if: |
# ${{ startsWith(github.ref, 'refs/heads/issue') }} ||
# ${{ startsWith(github.ref, 'refs/heads/dependabot/') }} ||
# ${{ startsWith(github.ref, 'refs/heads/feature/') }}
# run: |
# new_ver="${{ steps.get-version.outputs.current_version }}+$(git rev-parse --short ${GITHUB_SHA})"
# poetry version $new_ver
# echo "software_version=$(poetry version | awk '{print $2}')" >> $GITHUB_ENV
#
# - name: Bump alpha version
# # If triggered by push to the develop branch
# if: ${{ github.ref == 'refs/heads/develop' }}
# run: |
# poetry version prerelease
# echo "software_version=$(poetry version | awk '{print $2}')" >> $GITHUB_ENV
# echo "venue=sit" >> $GITHUB_ENV
#
# - name: Bump rc version
# # If triggered by push to a release branch
# if: ${{ startsWith(github.ref, 'refs/heads/release/') }}
# env:
# # True if the version already has a 'rc' pre-release identifier
# BUMP_RC: ${{ contains(steps.get-version.outputs.current_version, 'rc') }}
# run: |
# if [ "$BUMP_RC" = true ]; then
# poetry version prerelease
# else
# poetry version ${GITHUB_REF#refs/heads/release/}rc1
# fi
# echo "software_version=$(poetry version | awk '{print $2}')" >> $GITHUB_ENV
# echo "venue=uat" >> $GITHUB_ENV
#
# - name: Release version
# # If triggered by push to the main branch
# if: ${{ startsWith(github.ref, 'refs/heads/main') }}
# env:
# CURRENT_VERSION: ${{ steps.get-version.outputs.current_version }}
# # Remove rc* from the end of version string
# # The ${string%%substring} syntax below deletes the longest match of $substring from back of $string.
# run: |
# poetry version ${CURRENT_VERSION%%rc*}
# echo "software_version=$(poetry version | awk '{print $2}')" >> $GITHUB_ENV
# echo "venue=ops" >> $GITHUB_ENV
#
# - name: Commit Version Bump
# # If building develop, a release branch, or main then we commit the version bump back to the repo
# if: |
# github.ref == 'refs/heads/develop' ||
# github.ref == 'refs/heads/main' ||
# startsWith(github.ref, 'refs/heads/release')
# run: |
# git config --global user.name 'batchee bot'
# git config --global user.email '[email protected]'
# git commit -am "/version ${{ env.software_version }}"
# git push
#
# - name: Push Tag
# if: |
# github.ref == 'refs/heads/develop' ||
# github.ref == 'refs/heads/main' ||
# startsWith(github.ref, 'refs/heads/release')
# run: |
# git config user.name "${GITHUB_ACTOR}"
# git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
# git tag -a "${{ env.software_version }}" -m "Version ${{ env.software_version }}"
# git push origin "${{ env.software_version }}"
# - name: Build Python Artifact
# run: |
# poetry build
#
# - uses: actions/upload-artifact@v3
# with:
# name: python-artifact
# path: dist/*
#
# - name: Publish to test.pypi.org
# id: pypi-test-publish
# if: |
# github.ref == 'refs/heads/develop' ||
# startsWith(github.ref, 'refs/heads/release')
# env:
# POETRY_PYPI_TOKEN_TESTPYPI: ${{secrets.POETRY_PYPI_TOKEN_TESTPYPI}}
# run: |
# poetry config repositories.testpypi https://test.pypi.org/legacy/
# poetry publish -r testpypi
#
# - name: Publish to pypi.org
# if: ${{ github.ref == 'refs/heads/main' }}
# id: pypi-publish
# env:
# POETRY_PYPI_TOKEN_PYPI: ${{secrets.POETRY_PYPI_TOKEN_PYPI}}
# run: |
# poetry publish