-
Notifications
You must be signed in to change notification settings - Fork 1
86 lines (70 loc) · 1.97 KB
/
PackagePublish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Publish Package
on:
release:
types: [ released ]
permissions:
contents: read
pages: write
id-token: write
jobs:
run-tests:
name: Tests
uses: ./.github/workflows/PackageTest.yml
secrets: inherit
build-docs:
name: Docs
needs: run-tests
uses: ./.github/workflows/DocumentationBuild.yml
secrets: inherit
publish-package:
name: Publish Distribution
needs: build-docs
runs-on: ubuntu-latest
environment: ${{ matrix.environment }}
strategy:
fail-fast: false
matrix:
include:
- host: https://py00.crc.pitt.edu
environment: publish-h2p
- host: https://upload.pypi.org/legacy/
environment: publish-pypi
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: false
# Get the new package version from the release tag
# Git release tags are expected to start with "refs/tags/v"
- name: Set package version
run: |
release_tag=${{github.ref}}
poetry version "${release_tag#refs/tags/v}"
- name: Build package
run: poetry build -v
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
print-hash: true
repository-url: ${{ matrix.host }}
user: ${{ secrets.REPO_USER }}
password: ${{ secrets.REPO_PASSWORD }}
publish-docs:
name: Deploy Documentation
needs: [ build-docs, publish-package ]
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4