forked from kabooboo/giphon
-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (33 loc) · 1.15 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
name: Release
on:
release:
types: [created]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install hatch
- name: Build and publish
env:
HATCH_INDEX_USER: __token__
HATCH_INDEX_AUTH: ${{ secrets.PYPI_API_TOKEN }}
run: |
if [ "$(hatch version)" != "$GITHUB_REF_NAME" ]; then
echo -e "Missmatch between tag and __version__.\nCancelling release..."
exit 1
fi
# First, a quick hack to replace images with their absolute
# counterparts so that `pypi` images render correctly
export GH_CONTENT_URL_PREFIX="https:\/\/raw.githubusercontent.com\/${GITHUB_REPOSITORY}\/${GITHUB_REF_NAME}\/"
perl -i -pe 's~!\[(.*)\]\((?!https|http)[.\/]*(.*)\)~![$1]('"$GH_CONTENT_URL_PREFIX"'$2)~g' README.md
# Then, we publish the package
hatch build
hatch publish --yes