Skip to content

Commit 975bf8d

Browse files
authored
Update release action (#101)
* Update release action * Comment-out deployment to PyPI for testing * Fix identation * Fix version of pypa/gh-action-pypi-publish * Bump version * Fixes * Revert testing changes
1 parent 8e89b40 commit 975bf8d

File tree

1 file changed

+18
-55
lines changed

1 file changed

+18
-55
lines changed

.github/workflows/release_n_deploy.yml

Lines changed: 18 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,19 @@ jobs:
3131
run: twine check dist/*
3232

3333
- name: Upload package artifacts
34-
uses: actions/upload-artifact@master
34+
uses: actions/upload-artifact@v4
3535
with:
3636
name: package-artifacts
3737
path: dist/
3838

3939
- name: Publish package to PyPI
40-
uses: pypa/gh-action-pypi-publish@master
40+
uses: pypa/gh-action-pypi-publish@release/v1
4141
with:
42-
user: __token__
4342
password: ${{ secrets.test_pypi_password }}
44-
repository_url: https://test.pypi.org/legacy/
43+
repository-url: https://test.pypi.org/legacy/
4544

46-
# Sleep for some seconds to give Test PyPI time to update the search index
47-
- name: Sleep for 120 seconds
48-
uses: jakejarvis/wait-action@master
49-
with:
50-
time: '120s'
45+
- name: Sleep for 120 seconds to give Test PyPI time to update the search index
46+
run: sleep 120
5147

5248
verify-test-pypi:
5349
name: Install from Test PyPI
@@ -63,16 +59,13 @@ jobs:
6359
with:
6460
python-version: "3.x"
6561

66-
- name: Get release version
67-
id: release_version
68-
run: |
69-
echo ::set-output name=number::${GITHUB_REF#refs/*/}
70-
echo ${{ steps.release_version.outputs.number }}
71-
72-
- name: Install torch-lr-finder ${{ steps.release_version.outputs.number }} from Test PyPI
62+
- name: Install torch-lr-finder ${{ github.ref_name }} from Test PyPI
7363
run: |
7464
python -m pip install --upgrade pip
75-
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple torch-lr-finder==${{ steps.release_version.outputs.number }}
65+
pip install \
66+
--index-url https://test.pypi.org/simple/ \
67+
--extra-index-url https://pypi.org/simple \
68+
torch-lr-finder==${{ github.ref_name }}
7669
7770
release:
7871
name: Create Release
@@ -83,43 +76,14 @@ jobs:
8376
- name: Checkout repository
8477
uses: actions/checkout@v4
8578

86-
# We need the whole history so we can later generate the release notes from the commit logs
87-
- name: Fetch all history for all tags and branches
88-
run: git fetch --prune --unshallow
89-
90-
# Generate draft release notes by taking the commit logs between this release and the previous
91-
- name: Generate draft release notes
92-
id: release_notes
93-
run: |
94-
# Get the whole commit log with a pretty and easy to post-process format
95-
notes="$(git log --pretty=format:' -%d%Creset %s' --abbrev-commit)"
96-
97-
# Get commit logs between this tag and the previous one
98-
notes="$(awk '/tag: v/ { flag=!flag; count+=1; next } flag && count < 2 {print}' <<< "$notes")"
99-
100-
# Remove all merge commits for a cleaner log
101-
notes="$(sed '/Merge pull request #/d' <<< "$notes")"
102-
103-
# Some weird string replacements to escape special characters...blame GitHub
104-
# for this https://github.community/t5/GitHub-Actions/set-output-Truncates-Multiline-Strings/td-p/37870
105-
notes="${notes//'%'/'%25'}"
106-
notes="${notes//$'\n'/'%0A'}"
107-
notes="${notes//$'\r'/'%0D'}"
108-
109-
echo "::set-output name=content::$notes"
110-
11179
- name: Create draft release
112-
uses: actions/create-release@master
80+
run: |
81+
gh release create ${{ github.ref_name }} \
82+
--title "Release ${{ github.ref_name }}" \
83+
--generate-notes \
84+
--draft
11385
env:
114-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
115-
with:
116-
tag_name: ${{ github.ref }}
117-
release_name: Release ${{ github.ref }}
118-
body: |
119-
Release notes:
120-
${{ steps.release_notes.outputs.content }}
121-
draft: true
122-
prerelease: false
86+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12387

12488
deploy-pypi:
12589
name: Deploy to PyPI
@@ -128,13 +92,12 @@ jobs:
12892

12993
steps:
13094
- name: Download package artifacts
131-
uses: actions/download-artifact@master
95+
uses: actions/download-artifact@v4
13296
with:
13397
name: package-artifacts
13498
path: dist/
13599

136100
- name: Publish package to PyPI
137-
uses: pypa/gh-action-pypi-publish@master
101+
uses: pypa/gh-action-pypi-publish@release/v1
138102
with:
139-
user: __token__
140103
password: ${{ secrets.pypi_password }}

0 commit comments

Comments
 (0)