Skip to content

Commit

Permalink
ci: Add publish-main workflow
Browse files Browse the repository at this point in the history
This is based on the following commit with a few changes:
https://github.com/JonathonReinhart/scuba/blob/b086413404/.github/workflows/publish-main.yml

- pip install setuptools wheel
- apt install scons
- CC -> BOOTLOADER_CC

TODO: Un-comment branches: main
  • Loading branch information
JonathonReinhart committed Jul 10, 2023
1 parent 3786a9f commit b372c31
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 5 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/publish-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Upload to Test PyPI

# On every push to main, push to Test PyPI
on:
push:
#branches:
# - main

# TODO: De-duplicate with python-publish-release.yml

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

# https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches
- name: Unshallow checkout
run: git fetch --prune --unshallow

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
sudo apt-get update
sudo apt-get install -y musl-tools scons
- name: Build
env:
BOOTLOADER_CC: /usr/bin/musl-gcc
CI_VERSION_BUILD_NUMBER: ${{ github.run_id }}
run: python setup.py sdist bdist_wheel

- name: Publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_TEST_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_TEST_PASSWORD }}
run: twine upload --repository-url https://test.pypi.org/legacy/ dist/*
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
def get_dynamic_version():
import staticx.version

# Travis builds
# If we're not building for a tag, then append the build number
build_num = os.getenv('TRAVIS_BUILD_NUMBER')
build_tag = os.getenv('TRAVIS_TAG')
if (not build_tag) and (build_num != None):
# CI builds
# If CI_VERSION_BUILD_NUMBER is set, append that to the base version
build_num = os.getenv("CI_VERSION_BUILD_NUMBER")
if build_num:
return f'{staticx.version.BASE_VERSION}.{build_num}'

# Otherwise, use the auto-versioning
return staticx.version.__version__


Expand Down

0 comments on commit b372c31

Please sign in to comment.