Skip to content

Commit

Permalink
seperate out testing pushes
Browse files Browse the repository at this point in the history
  • Loading branch information
Wh1t3Fox committed May 20, 2022
1 parent 3e2141a commit 6468554
Show file tree
Hide file tree
Showing 2 changed files with 148 additions and 11 deletions.
144 changes: 144 additions & 0 deletions .github/workflows/publish-to-pypi-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
name: Build and Publish to Testing PyPI on Push
on:
push:
branches:
- 'master'
- 'main'

jobs:
release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
Changes in this Release
draft: false
prerelease: false

arm_builds:
needs: release
runs-on: ${{matrix.os}}
strategy:
matrix:
os: ["buster"]
platform: ["armv6", "armv7", "aarch64"]
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v3
- uses: uraimo/[email protected]
name: Setup Python ${{ matrix.python-version }} on ${{ matrix.platform }}
with:
arch: ${{ matrix.platform }}
distro: ${{ matrix.os }}
githubToken: ${{ github.token }}
shell: /bin/bash
install: |
apt-get update -q -y
apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev
curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
cat << EOT >> ~/.bashrc
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
EOT
source ~/.bashrc
pyenv install ${{ matrix.python-version }}
pyenv global ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install flit
python -m flit install
- name: Build and Publish
run: |
python -m flit build
macos_builds:
needs: release
runs-on: ${{matrix.os}}
strategy:
matrix:
os: ["macos-latest"]
platform: ["x64"]
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v3
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.platform }}

- name: Install Dependencies
run: |
python -m pip install flit
python -m flit install
- name: Build and Publish
run: |
python -m flit build
linux_builds:
needs: release
runs-on: ${{matrix.os}}
strategy:
matrix:
os: ["ubuntu-latest"]
platform: ["x64"]
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v3
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.platform }}

- name: Install Dependencies
run: |
python -m pip install flit
python -m flit install
- name: Build and Publish
run: |
python -m flit build
deploy:
needs: [linux_builds, macos_builds, arm_builds]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"

- name: Install Dependencies
run: |
python -m pip install flit
python -m flit install
- name: Build and Publish
run: |
python -m flit build
- name: Publish distribution to TestPyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.testpypi_token }}
repository_url: https://test.pypi.org/legacy/
15 changes: 4 additions & 11 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish Python distribution to PyPI and TestPyPI
name: Build and Publish to PyPI on Version Release
on:
push:
tags:
Expand Down Expand Up @@ -34,11 +34,12 @@ jobs:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v3
- uses: uraimo/run-on-arch-action@v2
- uses: uraimo/run-on-arch-action@v2.2.0
name: Setup Python ${{ matrix.python-version }} on ${{ matrix.platform }}
with:
arch: ${{ matrix.platform }}
distro: ${{ matrix.os }}
githubToken: ${{ github.token }}
shell: /bin/bash
install: |
apt-get update -q -y
Expand Down Expand Up @@ -117,7 +118,7 @@ jobs:
python -m flit build
deploy:
needs: linux_builds
needs: [linux_builds, macos_builds, arm_builds]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -134,14 +135,6 @@ jobs:
run: |
python -m flit build
- name: Publish distribution to TestPyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.testpypi_token }}
repository_url: https://test.pypi.org/legacy/

- name: Publish distribution to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
Expand Down

0 comments on commit 6468554

Please sign in to comment.