Merge pull request #95 from JenspederM/ci/remember-checkout #145
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
# .github/workflows/ci-cd.yml | |
on: | |
push: | |
branches: | |
- main | |
- master | |
jobs: | |
integration_tests: | |
name: Integration Tests | |
if: ${{ !startsWith(github.event.head_commit.message, 'bump:') && github.repository_owner_id == github.actor_id }} | |
uses: ./.github/workflows/integration_tests.yml | |
secrets: | |
DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }} | |
DATABRICKS_CLIENT_ID: ${{ secrets.DATABRICKS_CLIENT_ID }} | |
DATABRICKS_CLIENT_SECRET: ${{ secrets.DATABRICKS_CLIENT_SECRET }} | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
version: | |
name: Set Name and Version from pyproject.toml to output | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
needs: | |
- integration_tests | |
outputs: | |
name: ${{ steps.check_version.outputs.name }} | |
old_version: ${{ steps.check_version.outputs.old_version }} | |
new_version: ${{ steps.check_version.outputs.new_version }} | |
is_changed: ${{ steps.check_version.outputs.is_changed }} | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
with: | |
token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}" | |
fetch-depth: 0 | |
- name: Check Version | |
uses: ./.github/actions/check_version | |
id: check_version | |
with: | |
github_token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}" | |
push: true | |
pypi-publish: | |
name: Upload release to PyPI | |
runs-on: ubuntu-latest | |
if: ${{ needs.version.outputs.is_changed == 'true' }} | |
needs: | |
- integration_tests | |
- version | |
strategy: | |
matrix: | |
python-version: ["3.9"] | |
environment: | |
name: pypi | |
url: https://pypi.org/p/kedro-databricks | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
with: | |
token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}" | |
fetch-depth: 0 | |
- uses: databricks/setup-cli@main | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Sync kedro-databricks | |
run: uv sync | |
- name: Build package | |
run: uv build | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
- name: Upload release to GitHub | |
uses: softprops/action-gh-release@v1 | |
env: | |
PACKAGE_NAME: ${{ needs.version.outputs.name }} | |
VERSION: ${{ needs.version.outputs.new_version }} | |
with: | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
tag_name: ${{ env.VERSION }} | |
body_path: "body.md" | |
files: | | |
dist/${{ env.PACKAGE_NAME }}-${{ env.VERSION }}-py3-none-any.whl | |
dist/${{ env.PACKAGE_NAME }}-${{ env.VERSION }}.tar.gz |