Andrea Maldonado commited on
Commit
25b3700
Β·
1 Parent(s): ddaf251

Restores pypi_release

Browse files
Files changed (1) hide show
  1. .github/workflows/pypi_release.yml +101 -0
.github/workflows/pypi_release.yml ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Publish Python 🐍 distribution πŸ“¦ to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*.*.*' # Triggers the workflow when a new version tag is pushed
7
+
8
+ jobs:
9
+ build:
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - name: Check out the code
14
+ uses: actions/checkout@v4
15
+
16
+ - name: Set up Python
17
+ uses: actions/setup-python@v5
18
+ with:
19
+ python-version: '3.x' # Specify your Python version
20
+
21
+ - name: Install pypa/build
22
+ run: >-
23
+ python3 -m
24
+ pip install
25
+ build
26
+ --user
27
+ - name: Build a binary wheel and a source tarball
28
+ run: python3 -m build
29
+ - name: Store the distribution packages
30
+ uses: actions/upload-artifact@v3
31
+ with:
32
+ name: python-package-distributions
33
+ path: dist/
34
+
35
+ publish-to-pypi:
36
+ name: >-
37
+ Publish Python 🐍 distribution πŸ“¦ to PyPI
38
+ if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
39
+ needs:
40
+ - build
41
+ runs-on: ubuntu-latest
42
+ environment:
43
+ name: pypi
44
+ url: https://pypi.org/p/GEDI
45
+ permissions:
46
+ id-token: write # IMPORTANT: mandatory for trusted publishing
47
+
48
+ steps:
49
+ - name: Download all the dists
50
+ uses: actions/download-artifact@v3
51
+ with:
52
+ name: python-package-distributions
53
+ path: dist/
54
+ - name: Publish distribution πŸ“¦ to PyPI
55
+ uses: pypa/gh-action-pypi-publish@release/v1
56
+
57
+ github-release:
58
+ name: >-
59
+ Sign the Python 🐍 distribution πŸ“¦ with Sigstore
60
+ and upload them to GitHub Release
61
+ needs:
62
+ - publish-to-pypi
63
+ runs-on: ubuntu-latest
64
+
65
+ permissions:
66
+ contents: write # IMPORTANT: mandatory for making GitHub Releases
67
+ id-token: write # IMPORTANT: mandatory for sigstore
68
+
69
+ steps:
70
+ - name: Download all the dists
71
+ uses: actions/download-artifact@v3
72
+ with:
73
+ name: python-package-distributions
74
+ path: dist/
75
+ - name: Sign the dists with Sigstore
76
+ uses: sigstore/[email protected]
77
+ with:
78
+ inputs: >-
79
+ ./dist/*.tar.gz
80
+ ./dist/*.whl
81
+ - name: Create GitHub Release
82
+ env:
83
+ GITHUB_TOKEN: ${{ github.token }}
84
+ run: >-
85
+ gh release create
86
+ '${{ github.ref_name }}'
87
+ --repo '${{ github.repository }}'
88
+ --notes ""
89
+ - name: Upload artifact signatures to GitHub Release
90
+ env:
91
+ GITHUB_TOKEN: ${{ github.token }}
92
+ # Upload to GitHub Release using the `gh` CLI.
93
+ # `dist/` contains the built packages, and the
94
+ # sigstore-produced signatures and certificates.
95
+ run: >-
96
+ gh release upload
97
+ '${{ github.ref_name }}' dist/**
98
+ --repo '${{ github.repository }}'
99
+
100
+ - name: Cleanup
101
+ run: rm -rf dist