Merge pull request #372 from snowplow/release/1.0.4 #15
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
on: | |
push: | |
tags: | |
- '*.*.*' | |
jobs: | |
version_check: | |
runs-on: ubuntu-20.04 | |
outputs: | |
v_tracker: ${{ steps.version.outputs.PYTHON_TRACKER_VERSION}} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
- name: Get tag and tracker versions | |
id: version | |
run: | | |
echo "TAG_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | |
echo "PYTHON_TRACKER_VERSION=$(python setup.py --version)" >> $GITHUB_OUTPUT | |
- name: Fail if version mismatch | |
if: ${{ steps.version.outputs.TAG_VERSION != steps.version.outputs.PYTHON_TRACKER_VERSION }} | |
run: | | |
echo "Tag version (${{ steps.version.outputs.TAG_VERSION }}) doesn't match version in project (${{ steps.version.outputs.PYTHON_TRACKER_VERSION }})" | |
exit 1 | |
build: | |
needs: ["version_check"] | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
python-version: [3.8] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Pin pip version | |
run: | | |
echo "pip_v=pip" >> $GITHUB_ENV | |
- name: Build | |
run: | | |
python -m pip install --upgrade "${{ env.pip_v }}" setuptools wheel | |
python setup.py sdist bdist_wheel | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: distfiles_${{ github.run_id }} | |
path: dist | |
publish: | |
needs: ["build"] | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Download artifacts | |
uses: actions/[email protected] | |
with: | |
name: distfiles_${{ github.run_id }} | |
path: ${{ github.workspace }}/dist | |
- name: Twine check | |
run: | | |
python -m pip install --upgrade pip twine | |
twine check ${{ github.workspace }}/dist/* | |
- name: Publish to PyPI | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} | |
packages_dir: ${{ github.workspace }}/dist/ | |
verbose: true | |
release: | |
needs: ["publish", "version_check"] | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
name: Version ${{ needs.version_check.outputs.v_tracker }} | |
draft: false | |
prerelease: ${{ contains(needs.version_check.outputs.v_tracker, 'rc') }} |