Skip to content

fetch before checkout #162

fetch before checkout

fetch before checkout #162

Workflow file for this run

name: Core / Project release on PyPi
# The pushed tag must be formatted like so:
# * integrations/<INTEGRATION_FOLDER_NAME>-v1.0.0
#
# For example, if we want to release version 1.0.99
# of the google-vertex-haystack integration we'd have to push the tag:
#
# integrations/google_vertex-v1.0.99
on:
push:
tags:
- "**-v[0-9].[0-9]+.[0-9]+"
jobs:
release-on-pypi:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Hatch
run: pip install hatch
- name: Get project folder
id: pathfinder
shell: python
run: |
import os
project_path = "${{ github.ref_name }}".rsplit("-", maxsplit=1)[0]
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
print(f'project_path={project_path}', file=f)
- name: Build extra
working-directory: ${{ steps.pathfinder.outputs.project_path }}
run: hatch build
- name: Publish on PyPi
working-directory: ${{ steps.pathfinder.outputs.project_path }}
env:
HATCH_INDEX_USER: __token__
HATCH_INDEX_AUTH: ${{ secrets.PYPI_API_TOKEN }}
run: hatch publish -y
- name: Generate changelog
uses: tj-actions/git-cliff@v1
with:
args: >
--include-path "${{ steps.pathfinder.outputs.project_path }}/*"
--tag-pattern "${{ steps.pathfinder.outputs.project_path }}-v*"
-o "${{ steps.pathfinder.outputs.project_path }}/CHANGELOG.md"
- name: Commit changelog
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.HAYSTACK_BOT_TOKEN }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git fetch
git checkout main
git add ${{ steps.pathfinder.outputs.project_path }}
git commit -m"Update the changelog"
git push origin main