-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (55 loc) · 1.52 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
name: Publish Package
on:
release:
types: [ released ]
permissions:
contents: read
pages: write
id-token: write
jobs:
run-tests:
name: Tests
permissions:
packages: read
contents: read
uses: ./.github/workflows/PackageTest.yml
secrets: inherit
publish-package:
name: Publish Distribution
needs: run-tests
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 }}