-
Notifications
You must be signed in to change notification settings - Fork 3.4k
190 lines (178 loc) · 6.63 KB
/
release-pkg.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
name: Releasing packages
# https://help.github.com/en/actions/reference/events-that-trigger-workflows
on:
push:
branches: [master, "release/*"]
release:
types: [published]
pull_request: # this shall test only the part of workflow before publishing
branches: [master, "release/*"]
types: [opened, reopened, ready_for_review, synchronize]
paths:
- "requirements/ci.txt"
- ".github/actions/pkg-check/*"
- ".github/actions/pkg-publish/*"
- ".github/workflows/_legacy-checkpoints.yml.yml"
- ".github/workflows/_build-packages.yml"
- ".github/workflows/release-pypi.yml"
defaults:
run:
shell: bash
env:
FREEZE_REQUIREMENTS: 1
TORCH_URL: "https://download.pytorch.org/whl/cpu/torch_stable.html"
PYTHON_VER: "3.9"
jobs:
build-packages:
uses: ./.github/workflows/_build-packages.yml
with:
artifact-name: dist-packages-${{ github.sha }}
upload-packages:
runs-on: ubuntu-22.04
needs: build-packages
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: dist-packages-${{ github.sha }}
path: dist
- run: ls -lh dist/
- name: Upload to release
uses: AButler/[email protected]
with:
files: "dist/*/*"
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-version:
runs-on: ubuntu-22.04
outputs:
tag: ${{ steps.lai-package.outputs.version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VER }}
- name: install Package
run: |
pip install . -f ${TORCH_URL}
pip list
- name: package Version
id: lai-package
run: python -c "import lightning ; print(f'version={lightning.__version__}')" >> $GITHUB_OUTPUT
signaling:
runs-on: ubuntu-22.04
needs: ["release-version", "build-packages"]
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
env:
TAG: ${{ needs.release-version.outputs.tag }}
BRANCH_NAME: "trigger/lightning-${{ needs.release-version.outputs.tag }}"
steps:
- uses: actions/checkout@v4
with:
repository: gridai/base-images
token: ${{ secrets.PAT_GHOST }}
- name: Update lightning version
run: |
import json, os, re
tag = os.getenv('TAG')
fname_json = "versions.json"
with open(fname_json, encoding="utf-8") as fopen:
vers = json.load(fopen)
vers["lightning_version"] = tag
conda_ = vers["conda_snapshot"].split(".")
conda_[-1] = str(int(conda_[-1]) + 1)
vers["conda_snapshot"] = ".".join(conda_)
with open(fname_json, "w", encoding="utf-8") as fopen:
json.dump(vers, fopen, indent=2)
# satisfy pre-commit with line fixer
fopen.write(os.linesep)
fname_txt = "conda-user/user-env-requirements.txt"
with open(fname_txt, encoding="utf-8") as fopen:
reqs = fopen.read()
reqs = re.sub(r"lightning\w*==([\d\.]+)", f"lightning=={tag}", reqs)
with open(fname_txt, "w", encoding="utf-8") as fopen:
fopen.write(reqs)
shell: python
- run: cat versions.json
- name: Create Pull Request
if: github.event_name != 'pull_request'
uses: peter-evans/create-pull-request@v7
with:
title: "Bump lightning ver `${{ env.TAG }}`"
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
token: ${{ secrets.PAT_GHOST }}
add-paths: |
versions.json
conda-user/user-env-requirements.txt
commit-message: "bumping lightning version -> (${{ env.TAG }})"
branch: "bump/lightning-${{ env.TAG }}"
# Delete the branch when closing pull requests, and when undeleted after merging.
delete-branch: true
# the PR"s body/content
body: >
**This is automated update with the latest lighting [release](https://github.com/Lightning-AI/lightning/releases/tag/${{ env.TAG }})!**
Please, act swiftly to land this PR as it is effectively blocking lightning release to be finished...
assignees: |
justusschock
borda
reviewers: |
justusschock
ethanwharris
borda
pre-publish-packages:
runs-on: ubuntu-22.04
needs: build-packages
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
strategy:
fail-fast: false
matrix:
name: ["FABRIC", "PYTORCH", "LIGHTNING"]
steps:
- uses: actions/checkout@v4 # needed for local action below
- uses: actions/download-artifact@v3
with:
name: dist-packages-${{ github.sha }}
path: dist
- name: Browse folder
id: folder
run: |
sudo apt install -q -y tree
tree -L 2 -h dist/
python -c "print('pkg=' + '${{ matrix.name }}'.lower())" >> $GITHUB_OUTPUT
- uses: ./.github/actions/pkg-publish
with:
pkg-folder: dist/${{ steps.folder.outputs.pkg }}
pypi-test-token: ${{ secrets[format('PYPI_TEST_TOKEN_{0}', matrix.name)] }}
publish-packages:
runs-on: ubuntu-22.04
needs: [build-packages]
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
strategy:
fail-fast: false
matrix:
name: ["FABRIC", "PYTORCH", "LIGHTNING"]
steps:
- uses: actions/checkout@v4 # needed for local action below
- uses: actions/download-artifact@v3
with:
name: dist-packages-${{ github.sha }}
path: dist
- name: Browse folder
id: folder
run: |
sudo apt install -q -y tree
tree -L 2 -h dist/
python -c "print('pkg=' + '${{ matrix.name }}'.lower())" >> $GITHUB_OUTPUT
- uses: ./.github/actions/pkg-publish
with:
pkg-folder: dist/${{ steps.folder.outputs.pkg }}
pypi-token: ${{ secrets[format('PYPI_TOKEN_{0}', matrix.name)] }}
legacy-checkpoints:
needs: [build-packages]
uses: ./.github/workflows/_legacy-checkpoints.yml
with:
push_to_s3: ${{ startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' }}
upload_local: ${{ startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' }}
create_pr: ${{ startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' }}
secrets: inherit