-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (114 loc) · 3.56 KB
/
release.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
136
137
138
139
140
141
142
143
name: Release
run-name: Release 🚀
on:
push:
branches:
- main
permissions:
contents: read
env:
POETRY_VERSION: "1.8.3"
PYTHON_VERSION: "3.9"
jobs:
build:
name: Build and Release
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
outputs:
target_version: ${{ steps.export_version.outputs.target_version }}
steps:
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Poetry v${{ env.POETRY_VERSION }}
run: pipx install poetry==${{ env.POETRY_VERSION }}
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Python Semantic Release to prepare release
id: release
uses: python-semantic-release/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
if-no-files-found: 'error'
- name: Save Tag reference
id: export_version
run: echo "target_version=$(git describe --exact-match | cut -c2-)" >> $GITHUB_OUTPUT
publish-to-test-pypi:
name: Publish to Test PyPI
runs-on: ubuntu-latest
needs:
- build
permissions:
id-token: write
contents: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
test-installation-testpypi:
name: Test installation from Test PyPI
runs-on: ubuntu-latest
needs:
- build
- publish-to-test-pypi
steps:
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Installation test (with retry)
uses: nick-fields/retry@v2
env:
TARGET_VERSION: ${{needs.build.outputs.target_version}}
with:
timeout_minutes: 5
max_attempts: 3
command: |
pip install -i https://test.pypi.org/simple/ omegaconf_cloud_resolvers[aws,gcp]=="${TARGET_VERSION}"
python -c "import omegaconf_cloud_resolvers; print('Base import: OK')"
python -c "from omegaconf_cloud_resolvers.resolvers.aws import AWSParameterStoreResolver; print('AWS import: OK')"
python -c "from omegaconf_cloud_resolvers.resolvers.gcp import GCPSecretManagerResolver; print('GCP import: OK')"
publish-to-pypi:
name: Publish to PyPI
runs-on: ubuntu-latest
needs:
- test-installation-testpypi
permissions:
id-token: write
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
publish-docs:
name: Publish Docs
uses: ./.github/workflows/release_docs.yml
needs:
- build
- test-installation-testpypi
permissions:
id-token: write
contents: write
with:
tag_name: "${{needs.build.outputs.target_version}}"