Skip to content

Commit

Permalink
Move and revamp workflows, and add publishing workflow (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
agriyakhetarpal authored Feb 1, 2025
1 parent 37e2bc2 commit 35518ca
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 41 deletions.
43 changes: 6 additions & 37 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ jobs:
]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: recursive

- uses: actions/setup-python@v5
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: 3.12

- uses: pyodide/pyodide-actions/download-pyodide@v2
- uses: pyodide/pyodide-actions/download-pyodide@012fa537869d343726d01863a34b773fc4d96a14 # v2
with:
version: ${{ matrix.pyodide-version }}
to: dist

- uses: pyodide/pyodide-actions/install-browser@v2
- uses: pyodide/pyodide-actions/install-browser@012fa537869d343726d01863a34b773fc4d96a14 # v2
with:
runner: ${{ matrix.test-config.runner }}
browser: ${{ matrix.test-config.runtime }}
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
--runner=${{ matrix.test-config.runner }} \
--rt ${{ matrix.test-config.runtime }}
- uses: codecov/codecov-action@v5
- uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1
if: ${{ github.event.repo.name == 'pyodide/micropip' || github.event_name == 'pull_request' }}
with:
fail_ci_if_error: false
Expand All @@ -90,7 +90,7 @@ jobs:
run-integration-test: ${{ steps.check-integration-test-trigger.outputs.trigger }}

steps:
- uses: actions/checkout@cbb722410c2e876e24abbe8de2cc27693e501dcb # v4.2.2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.pull_request.head.sha }}
submodules: recursive
Expand All @@ -109,34 +109,3 @@ jobs:
"$COMMIT_MSG" =~ \[integration\] ]]; then
echo "trigger=true" >> "$GITHUB_OUTPUT"
fi
deploy:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
environment: PyPi-deploy
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- uses: actions/setup-python@v5
with:
python-version: 3.12

# IMPORTANT: always build sdist, and then the wheel from
# the sdist (like it is currently done here). This is
# because we want to ensure that no extra files get
# copied, which can be the case with building in-tree.
# The MANIFEST.in file ensures that the sdist doesn't
# contain any unnecessary files.
- name: Install requirements and build wheel
shell: bash -l {0}
run: |
python -m pip install build twine
python -m build .
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
63 changes: 63 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: release

on:
release:
types: [published]
workflow_dispatch:
schedule:
- cron: "0 3 * * 1"

env:
FORCE_COLOR: 3

jobs:
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: recursive

- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: 3.12

# IMPORTANT: always build sdist, and then the wheel from
# the sdist (like it is currently done here). This is
# because we want to ensure that no extra files get
# copied, which can be the case with building in-tree.
# The MANIFEST.in file ensures that the sdist doesn't
# contain any unnecessary files.
- name: Build package distributions
run: pipx run build

- name: Store the distribution packages
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: python-package-distributions
path: dist/
if-no-files-found: error

deploy:
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
environment: PyPi-deploy
permissions:
attestations: write
steps:
- name: Download all the dists
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
path: dist/
merge-multiple: true

- name: Generate artifact attestations
uses: actions/attest-build-provenance@7668571508540a607bdfd90a87a560489fe372eb # v2.1.0
with:
subject-path: "dist/*"

- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/remote_package_index_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ jobs:
]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: recursive

- uses: actions/setup-python@v5
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: 3.11.1

- uses: pyodide/pyodide-actions/download-pyodide@v2
- uses: pyodide/pyodide-actions/download-pyodide@012fa537869d343726d01863a34b773fc4d96a14 # v2
with:
version: ${{ matrix.pyodide-version }}
to: dist

- uses: pyodide/pyodide-actions/install-browser@v2
- uses: pyodide/pyodide-actions/install-browser@012fa537869d343726d01863a34b773fc4d96a14 # v2
with:
runner: ${{ matrix.test-config.runner }}
browser: ${{ matrix.test-config.runtime }}
Expand Down

0 comments on commit 35518ca

Please sign in to comment.