Skip to content

Commit

Permalink
chore: update release workflows (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
manzt authored Apr 27, 2023
1 parent d3b574d commit 374e919
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 29 deletions.
23 changes: 0 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
push:
branches:
- main
tags:
- "v*"
pull_request:
workflow_dispatch:

Expand Down Expand Up @@ -35,24 +33,3 @@ jobs:
- run: |
pip install --upgrade hatch
hatch run test
Deploy:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }}
run: |
python -m build
twine upload dist/*
27 changes: 21 additions & 6 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
name: Build and Deploy

on:
push:
branches:
- main

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: true

jobs:
build-and-deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand All @@ -16,10 +29,12 @@ jobs:
- run: |
python -m pip install --upgrade hatch
hatch run docs
touch dist/.nojekyll
- name: Deploy 🚀
uses: peaceiris/actions-gh-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
path: dist

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@main
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: CI

on:
push:
tags:
- "v*"
workflow_dispatch:

jobs:

Release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.x"

- run: |
pip install --upgrade hatch
hatch build
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TWINE_API_KEY }}

- run: npx [email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 374e919

Please sign in to comment.