Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEV: Release via REL commit #48

Merged
merged 2 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading