-
Notifications
You must be signed in to change notification settings - Fork 2
105 lines (97 loc) · 3.08 KB
/
publish.yaml
File metadata and controls
105 lines (97 loc) · 3.08 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Publish Python Package
on:
push:
branches: [main]
tags: ['[0-9]+.[0-9]+.[0-9]+']
workflow_dispatch:
jobs:
test:
uses: ./.github/workflows/test.yaml
build:
runs-on: ubuntu-24.04
needs: [test]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
- if: github.repository == 'chrishas35/simplefin-python-test'
run: sed -i -e 's/name = "simplefin"/name = "simplefin-test"/g' pyproject.toml
- uses: hynek/build-and-inspect-python-package@b5076c307dc91924a82ad150cdd1533b444d3310 # v2
publish-to-pypi:
name: Publish to PyPI
if: github.repository == 'chrishas35/simplefin-python' && startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
runs-on: ubuntu-24.04
needs: [build]
environment:
name: pypi
url: https://pypi.org/p/simplefin
permissions:
id-token: write
steps:
- name: Download distribution packages
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: Packages
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
github-release:
name: Create GitHub Release
needs: publish-to-pypi
runs-on: ubuntu-24.04
permissions:
contents: write
id-token: write
steps:
- name: Download distribution packages
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: Packages
path: dist
- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@04cffa1d795717b140764e8b640de88853c92acc # v3.3.0
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
# - name: Create GitHub Release
# env:
# GITHUB_TOKEN: ${{ github.token }}
# run: >-
# gh release create
# "$GITHUB_REF_NAME"
# --repo "$GITHUB_REPOSITORY"
# --notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
"$GITHUB_REF_NAME" dist/**
--repo "$GITHUB_REPOSITORY"
publish-to-testpypi:
name: Publish to TestPyPI
runs-on: ubuntu-24.04
needs: [build]
environment:
name: testpypi
url: https://test.pypi.org/p/simplefin
permissions:
id-token: write
steps:
- name: Download distribution packages
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: Packages
path: dist
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
verbose: true