Skip to content

Commit b53de39

Browse files
authored
DEV: Release via REL commit (#48)
1 parent 5b3b3cd commit b53de39

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

.github/workflows/release.yaml

+31-3
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,47 @@
66
name: Publish Python Package to PyPI
77
on:
88
push:
9-
tags:
10-
- '*.*.*'
9+
branches:
10+
- main
11+
12+
permissions:
13+
contents: write
1114

1215
jobs:
1316
build_and_publish:
1417
name: Publish a new version
1518
runs-on: ubuntu-latest
16-
19+
if: "${{ startsWith(github.event.head_commit.message, 'REL: ') }}"
1720
steps:
1821
# Ensure it's on PyPI
1922
- name: Checkout Repository
2023
uses: actions/checkout@v4
2124

25+
- name: Extract version from commit message
26+
id: extract_version
27+
run: |
28+
VERSION=$(echo "${{ github.event.head_commit.message }}" | grep -oP '(?<=REL: )\d+\.\d+\.\d+')
29+
echo "version=$VERSION" >> $GITHUB_OUTPUT
30+
31+
- name: Extract tag message from commit message
32+
id: extract_message
33+
run: |
34+
VERSION="${{ steps.extract_version.outputs.version }}"
35+
delimiter="$(openssl rand -hex 8)"
36+
MESSAGE=$(echo "${{ github.event.head_commit.message }}" | sed "0,/REL: $VERSION/s///" )
37+
echo "message<<${delimiter}" >> $GITHUB_OUTPUT
38+
echo "$MESSAGE" >> $GITHUB_OUTPUT
39+
echo "${delimiter}" >> $GITHUB_OUTPUT
40+
41+
- name: Create Git Tag
42+
run: |
43+
VERSION="${{ steps.extract_version.outputs.version }}"
44+
MESSAGE="${{ steps.extract_message.outputs.message }}"
45+
git config user.name github-actions
46+
git config user.email [email protected]
47+
git tag "$VERSION" -m "$MESSAGE"
48+
git push origin $VERSION
49+
2250
- name: Set up Python
2351
uses: actions/setup-python@v5
2452
with:

pdfly/up2.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def main(pdf: Path, output: Path) -> None:
1818
for i in range(0, len(reader.pages) - 1, 2):
1919
lhs = reader.pages[i]
2020
rhs = reader.pages[i + 1]
21-
lhs.mergeTranslatedPage(rhs, float(lhs.mediabox.right), 0, True)
21+
lhs.merge_translated_page(rhs, float(lhs.mediabox.right), 0, True)
2222
writer.add_page(lhs)
2323
print(str(i) + " ")
2424
sys.stdout.flush()

0 commit comments

Comments
 (0)