From 906654334ee97cb9d6912a021239398cd23aeaa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Cardona?= Date: Thu, 11 Jan 2024 16:06:46 +0100 Subject: [PATCH] github: add workflow to publish releases --- .github/workflows/publish-to-github.yml | 43 +++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/publish-to-github.yml diff --git a/.github/workflows/publish-to-github.yml b/.github/workflows/publish-to-github.yml new file mode 100644 index 0000000..08758ee --- /dev/null +++ b/.github/workflows/publish-to-github.yml @@ -0,0 +1,43 @@ +name: Publish to GitHub + +on: push + +jobs: + github-release: + name: Build distribution and push to GitHub + runs-on: ubuntu-latest + + if: startsWith(github.ref, 'refs/tags/') + + permissions: + contents: write # IMPORTANT: mandatory for making GitHub Releases + id-token: write # IMPORTANT: mandatory for sigstore + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.12" + - name: Install pypa/build + run: pip install build + - name: Build a binary wheel and a source tarball + run: python -m build + - 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 }}'