Skip to content

Commit

Permalink
DEV: Release via REL commit (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinThoma authored Mar 29, 2024
1 parent 5b3b3cd commit b53de39
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
34 changes: 31 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,47 @@
name: Publish Python Package to PyPI
on:
push:
tags:
- '*.*.*'
branches:
- main

permissions:
contents: write

jobs:
build_and_publish:
name: Publish a new version
runs-on: ubuntu-latest

if: "${{ startsWith(github.event.head_commit.message, 'REL: ') }}"
steps:
# Ensure it's on PyPI
- name: Checkout Repository
uses: actions/checkout@v4

- name: Extract version from commit message
id: extract_version
run: |
VERSION=$(echo "${{ github.event.head_commit.message }}" | grep -oP '(?<=REL: )\d+\.\d+\.\d+')
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Extract tag message from commit message
id: extract_message
run: |
VERSION="${{ steps.extract_version.outputs.version }}"
delimiter="$(openssl rand -hex 8)"
MESSAGE=$(echo "${{ github.event.head_commit.message }}" | sed "0,/REL: $VERSION/s///" )
echo "message<<${delimiter}" >> $GITHUB_OUTPUT
echo "$MESSAGE" >> $GITHUB_OUTPUT
echo "${delimiter}" >> $GITHUB_OUTPUT
- name: Create Git Tag
run: |
VERSION="${{ steps.extract_version.outputs.version }}"
MESSAGE="${{ steps.extract_message.outputs.message }}"
git config user.name github-actions
git config user.email github-actions@github.com
git tag "$VERSION" -m "$MESSAGE"
git push origin $VERSION
- name: Set up Python
uses: actions/setup-python@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion pdfly/up2.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def main(pdf: Path, output: Path) -> None:
for i in range(0, len(reader.pages) - 1, 2):
lhs = reader.pages[i]
rhs = reader.pages[i + 1]
lhs.mergeTranslatedPage(rhs, float(lhs.mediabox.right), 0, True)
lhs.merge_translated_page(rhs, float(lhs.mediabox.right), 0, True)
writer.add_page(lhs)
print(str(i) + " ")
sys.stdout.flush()
Expand Down

0 comments on commit b53de39

Please sign in to comment.