Skip to content

adding artifact upload + download between GH jobs #46

adding artifact upload + download between GH jobs

adding artifact upload + download between GH jobs #46

name: PyPi build and release
on: [push, workflow_dispatch]
jobs:
build:
name: PyPi build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install environment requirements
run: >-
python -m
pip install
-r
requirements.txt
- name: Run UTs
run: >-
python -m
unittest
discover
-v
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Bump patch version
run: >-
python -c "from onepassword.utils import bump_version; bump_version(version_type='patch')"
- name: Build a source tarball
run: >-
python -m
build
--sdist
--outdir dist/
.
uses: actions/upload-artifact@v3
with:
name: source-code
path: dist/
pypi-publish:
name: Pypi release
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: source-code
- name: Display downloaded files
run: ls -R
- name: Publish distribution 📦 to Test PyPI
# Specifying a GitHub environment is optional, but strongly encouraged
if: ${{ github.ref != 'refs/heads/main' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
if: ${{ github.ref == 'refs/heads/main' }}
uses: pypa/gh-action-pypi-publish@release/v1
- name: Add, commit and push version update
if: ${{ github.ref == 'refs/heads/main' }}
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git checkout main
git add .
git commit -m "[actions skip] GitHub bumping the version"
git push