Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ckan/ckanext-xloader into…
Browse files Browse the repository at this point in the history
… develop
  • Loading branch information
ThrawnCA committed Nov 14, 2024
2 parents 6cc48b7 + 6b68959 commit b270fb1
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 13 deletions.
35 changes: 23 additions & 12 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
#On versioned releases
tags:
- v*.*.*
- '*.*.*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
Expand Down Expand Up @@ -107,52 +107,63 @@ jobs:
name: Publish Package
runs-on: ubuntu-latest
environment:
name: ${{ github.event.inputs.environment }}
name: ${{ github.event.inputs.environment || 'pypi' }}
url: ${{ steps.version.outputs.url }}
concurrency:
group: ${{ github.event.inputs.environment }}-deployment
cancel-in-progress: false

env:
ENVIRONMENT: ${{ github.event.inputs.environment || 'pypi' }}
steps:
- name: Get Git Tag and set url from environment
id: version
run: |
#!/bin/bash
ENVIRONMENT=$1
TAG_VALUE=${GITHUB_REF/refs\/tags\//}
echo "version=${TAG_VALUE}" >> $GITHUB_ENV
echo "version=${TAG_VALUE}" >> $GITHUB_OUTPUT
# Extract the repository name (minus the owner/org)
reponame=$(basename $GITHUB_REPOSITORY)
echo "reponame=${reponame}" >> $GITHUB_OUTPUT
if [ "$ENVIRONMENT" == "pypi" ]; then
url="https://pypi.com/p/$reponame"
elif [ "$1" == "testpypi" ]; then
if [ "$env.ENVIRONMENT" == "testpypi" ]; then
url="https://test.pypi.com/p/$reponame"
echo "environment=${env.ENVIRONMENT}" >> $GITHUB_OUTPUT
else
url=""
url="https://pypi.com/p/$reponame"
echo "environment=pypi" >> $GITHUB_OUTPUT
fi
echo "url=${url}" >> $GITHUB_OUTPUT
- name: Checkout repository
uses: actions/checkout@v4

- name: Validate tag version
if: ${{ startsWith(github.ref, 'refs/tags') }}
run: |
PYTHON_VERSION=$(grep -E "\bversion='[^']+'" setup.py | awk -F "'" '{print $2}')
echo "Tag version is [${{ steps.version.outputs.version }}], Python version is [$PYTHON_VERSION]"
if [ "${{ steps.version.outputs.version }}" != "$PYTHON_VERSION" ]; then
echo "Version mismatch; tag version is [${{ steps.version.outputs.version }}] but Python version is [$PYTHON_VERSION]" >> $GITHUB_STEP_SUMMARY
exit 1
fi
- name: Build package ${{ steps.version.outputs.reponame }} @ ${{ steps.version.outputs.version }}
run: |
pip install build
pip install twine
python -m build
- name: Publish package distributions to PyPI
if: ${{ startsWith(github.ref, 'refs/tags') && (github.event.inputs.environment == 'pypi' || github.event.inputs.environment == 'publish' ) && github.event.inputs.dryRun != 'true'}}
if: ${{ startsWith(github.ref, 'refs/tags') && steps.version.outputs.environment == 'pypi' && github.event.inputs.dryRun != 'true' }}
uses: pypa/gh-action-pypi-publish@release/v1
# with:
# skip-existing: true
# verbose: true
# print-hash: true
- name: Test Publish package distributions to PyPI
if: ${{ startsWith(github.ref, 'refs/tags') && github.event.inputs.environment == 'testpypi' && github.event.inputs.dryRun == 'true' }}
if: ${{ startsWith(github.ref, 'refs/tags') && steps.version.outputs.environment == 'testpypi' && github.event.inputs.dryRun == 'true' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
1.1.2 2024-10-25
================

Feat:
* Frontend Status Badges by @JVickery-TBS in https://github.com/ckan/ckanext-xloader/pull/224

Fix:
* Fix automated PyPI publishing by @ThrawnCA in https://github.com/ckan/ckanext-xloader/pull/231


**Full Changelog**: https://github.com/ckan/ckanext-xloader/compare/1.1.1...1.1.2

1.1.1 2024-10-16
================

* feat: Add pypi cicd publish via github action via environment controls by @duttonw in https://github.com/ckan/ckanext-xloader/pull/228


**Full Changelog**: https://github.com/ckan/ckanext-xloader/compare/1.1.0...1.1.1

1.1.0 2024-10-16
================

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# http://packaging.python.org/en/latest/tutorial.html#version
version='1.1.1',
version='1.1.2',

description='Express Loader - quickly load data into CKAN DataStore''',
long_description=long_description,
Expand Down

0 comments on commit b270fb1

Please sign in to comment.