Merge branch 'main' of https://github.com/tgoelles/kedro-plugins #25
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: Check versions and build-publish | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
check-version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests | |
- name: Check version | |
run: python tools/github_actions/github_actions_release.py | |
- name: Set outputs | |
id: version_check | |
run: | | |
echo "new_release=${{ env.NEW_RELEASE }}" >> $GITHUB_OUTPUT | |
echo "package_name=${{ env.PACKAGE_NAME }}" >> $GITHUB_OUTPUT | |
echo "package_version=${{ env.PACKAGE_VERSION }}" >> $GITHUB_OUTPUT | |
outputs: | |
new_release: ${{ steps.version_check.outputs.new_release }} | |
package_name: ${{ steps.version_check.outputs.package_name }} | |
package_version: ${{ steps.version_check.outputs.package_version }} | |
airflow-test: | |
needs: check-version | |
if: ${{ needs.check-version.outputs.new_release == 'true' && needs.check-version.outputs.package_name == 'kedro-airflow' }} | |
uses: ./.github/workflows/kedro-airflow.yml | |
datasets-test: | |
needs: check-version | |
if: ${{ needs.check-version.outputs.new_release == 'true' && needs.check-version.outputs.package_name == 'kedro-datasets' }} | |
uses: ./.github/workflows/kedro-datasets.yml | |
docker-test: | |
needs: check-version | |
if: ${{ needs.check-version.outputs.new_release == 'true' && needs.check-version.outputs.package_name == 'kedro-docker' }} | |
uses: ./.github/workflows/kedro-docker.yml | |
telemetry-test: | |
needs: check-version | |
if: ${{ needs.check-version.outputs.new_release == 'true' && needs.check-version.outputs.package_name == 'kedro-telemetry' }} | |
uses: ./.github/workflows/kedro-telemetry.yml | |
build-publish: | |
needs: [ check-version, airflow-test, docker-test, datasets-test, telemetry-test ] | |
if: | | |
always() && | |
!contains(needs.*.result, 'failure') && | |
!contains(needs.*.result, 'cancelled') && | |
needs.check-version.outputs.new_release == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build | |
- name: Build package | |
run: | | |
export plugin=${{ needs.check-version.outputs.package_name }} | |
make package | |
- name: Extract release notes from ${{needs.check-version.outputs.package_name}}/RELEASE.md | |
id: extract | |
run: | | |
python tools/github_actions/extract_release_notes.py \ | |
"${{needs.check-version.outputs.package_name}}/RELEASE.md" \ | |
"Release ${{needs.check-version.outputs.package_version}}" | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{needs.check-version.outputs.package_name}}-${{needs.check-version.outputs.package_version}} | |
name: ${{needs.check-version.outputs.package_name}}-${{needs.check-version.outputs.package_version}} | |
body_path: release_body.txt | |
draft: false | |
prerelease: false | |
token: ${{ secrets.GH_TAGGING_TOKEN }} | |
- name: Set PyPI token | |
run: | | |
if [ "${{ needs.check-version.outputs.PACKAGE_NAME }}" == "kedro-airflow" ]; then | |
echo 'PYPI_TOKEN=${{ secrets.AIRFLOW_PYPI_TOKEN }}' >> $GITHUB_ENV | |
elif [ "${{ needs.check-version.outputs.PACKAGE_NAME }}" == "kedro-datasets" ]; then | |
echo 'PYPI_TOKEN=${{ secrets.DATASETS_PYPI_TOKEN }}' >> $GITHUB_ENV | |
elif [ "${{ needs.check-version.outputs.PACKAGE_NAME }}" == "kedro-docker" ]; then | |
echo 'PYPI_TOKEN=${{ secrets.DOCKER_PYPI_TOKEN }}' >> $GITHUB_ENV | |
elif [ "${{ needs.check-version.outputs.PACKAGE_NAME }}" == "kedro-telemetry" ]; then | |
echo 'PYPI_TOKEN=${{ secrets.TELEMETRY_PYPI_TOKEN }}' >> $GITHUB_ENV | |
fi | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages-dir: ${{ needs.check-version.outputs.package_name }}/dist | |
password: ${{ env.PYPI_TOKEN }} |