Skip to content

Commit

Permalink
Merge pull request #1 from db0/ci
Browse files Browse the repository at this point in the history
First release on pypi
  • Loading branch information
db0 authored Aug 9, 2023
2 parents a570a2c + c9735c9 commit ba0b801
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/publish_on_lemmy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

import os
import sys
import argparse
from pythorhead import Lemmy


arg_parser = argparse.ArgumentParser()
arg_parser.add_argument(
"version",
action="store",
help="The version being released",
)
args = arg_parser.parse_args()

bot_password = os.getenv("LEMMY_BOT_PASSWORD")
if not bot_password:
print("Bot password not set")
sys.exit(1)
lemmy = Lemmy("https://lemmy.dbzer0.com")
lemmy.log_in("div0", bot_password)
community_id = lemmy.discover_community("fediseer")
lemmy.post.create(
community_id,
f"New Pythonseer release {args.version}",
url=f"https://github.com/db0/pythonseer/releases/tag/{args.version}",
)
71 changes: 71 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Pythonseer build and publish

on:
push:
branches:
- main

jobs:
build-n-publish:
name: Pythonseer build and publish
runs-on: ubuntu-latest
steps:
- name: "✔️ Checkout"
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "📣 Release on push"
id: release
uses: rymndhng/release-on-push-action@v0.28.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
bump_version_scheme: norelease
use_github_release_notes: true
- name: "✏️ Generate release changelog"
if: ${{ steps.release.outputs.version != '' }}
uses: heinrichreimer/github-changelog-generator-action@v2.3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: "💾 Commit new version"
if: ${{ steps.release.outputs.version != '' }}
run: |
sed -i 's/^version = ".*"/version = "${{ steps.release.outputs.version }}"/g' ./pyproject.toml
git config user.email github-actions@github.com
git config user.name github-actions
git commit -am 'version incremented'
git push
- name: "🐍 Set up Python 3.10"
if: ${{ steps.release.outputs.version != '' }}
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: "🛠 Install pypa/build"
if: ${{ steps.release.outputs.version != '' }}
run: >-
python -m
pip install
build
--user
- name: "🔧 Build a binary wheel and a source tarball"
if: ${{ steps.release.outputs.version != '' }}
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: "📦 Publish distribution to PyPI"
if: ${{ steps.release.outputs.version != '' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}

- name: "🤖 Announce on lemmy.dbzer0.com"
if: ${{ steps.release.outputs.version != '' }}
run: |
python -m pip install -e .
python .github/publish_on_lemmy.py ${{ steps.release.outputs.version }}
env:
LEMMY_BOT_PASSWORD: ${{ secrets.LEMMY_BOT_PASSWORD }}
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Changelog
First release

0 comments on commit ba0b801

Please sign in to comment.