Skip to content

production

production #21

Workflow file for this run

name: Release on PR Merge
on: deployment
jobs:
deploy:
if: github.event.deployment.environment == 'production'
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: '${{ secrets.GAUGEBOT_GITHUB_TOKEN }}'
CI: true
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip' # caching pip dependencies
- name: Setup git
run: |
git config --global user.name "$(git --no-pager log --format=format:'%an' -n 1)"
git config --global user.email "$(git --no-pager log --format=format:'%ae' -n 1)"
- name: Build artifacts
run: |
pip install -r requirements.txt
python build.py --dist
- name: release
run: |
if [ -z "$version" ]; then
version=$(cd bin && ls gauge-python* | head -1 | sed "s/\.[^\.]*$//" | sed "s/gauge-python-//" | sed "s/-[a-z]*\.[a-z0-9_]*$//");
fi
echo "VERSION=$version" >> $GITHUB_ENV
echo "---------------------------"
echo "Updating release v$version"
echo "---------------------------"
echo -e "Gauge Python v$version\n\n" > desc.txt
release_description=$(ruby -e "$(curl -sSfL https://github.com/getgauge/gauge/raw/master/build/create_release_text.rb)" getgauge gauge-python)
echo "$release_description" >> desc.txt
echo "Creating new draft for release v$version"
gh release create --title "Gauge Python v${version}" --notes-file ./desc.txt "v${version}" bin/*
- name: 'deployment success'
if: success()
uses: 'deliverybot/deployment-status@v1'
with:
state: 'success'
token: '${{ secrets.GITHUB_TOKEN }}'
- name: 'deployment failure'
if: failure()
uses: 'deliverybot/deployment-status@v1'
with:
state: 'failure'
token: '${{ secrets.GITHUB_TOKEN }}'
- name: Upload PyPi package
env:
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python -m twine upload --non-interactive dist/getgauge*
- name: Update metadata in gauge-repository
run: |
git clone https://github.com/getgauge/gauge-repository.git
cd gauge-repository
python update_metadata.py python $VERSION
commit_message=$(echo -e "Update python to v$VERSION")
git add python-install.json
git commit -m "$commit_message"
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/getgauge/gauge-repository.git" master