From 841ab94a766afe4793e6d06e1b0a947ad0efec37 Mon Sep 17 00:00:00 2001 From: Catherine Date: Tue, 13 Feb 2024 11:10:30 +0000 Subject: [PATCH] CI: publish packages automatically. --- .github/workflows/main.yaml | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 2ce4093..fbf91a1 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -41,7 +41,7 @@ jobs: sudo add-apt-repository 'deb http://ppa.launchpad.net/sri-csl/formal-methods/ubuntu bionic main' sudo apt-get update sudo apt-get install yices2 - pip install codecov + pip install codecov build pdm install --dev - name: Cache YoWASP build products uses: actions/cache@v4 @@ -147,3 +147,32 @@ jobs: with: folder: pages/ clean: false + + publish-code: + needs: required + runs-on: ubuntu-latest + environment: publish + permissions: + id-token: write + steps: + - name: Check out source code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Build package + run: | + pip install build + python -m build + - name: Upload package artifact + uses: actions/upload-artifact@v4 + with: + name: code + path: dist/ + - name: Publish package to Test PyPI + if: ${{ github.repository == 'amaranth-lang/amaranth' && github.event_name == 'push' && github.event.ref == 'refs/heads/main' }} + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + - name: Publish package to PyPI + if: ${{ github.repository == 'amaranth-lang/amaranth' && github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') }} + uses: pypa/gh-action-pypi-publish@release/v1