Skip to content

production

production #14

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 }}'
PYPI_USER: '${{ secrets.PYPI_USER }}'
PYPI_PASSWORD: '${{ secrets.PYPI_PASSWORD }}'
CI: true
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.8'
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: |
cd bin
if [ -z "$version" ]; then
version=$(ls gauge-python* | head -1 | sed "s/\.[^\.]*$//" | sed "s/gauge-python-//" | sed "s/-[a-z]*\.[a-z0-9_]*$//");
fi
echo "VERSION=$version" >> $GITHUB_ENV
artifacts=()
dir=`pwd`
for i in `ls`; do
artifacts+="$dir/$i "
done
cd ..
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"
hub release create -F ./desc.txt "v$version"
rm -rf desc.txt
sleep 10
echo "Start uploading assets..."
for i in `ls $artifacts`; do
hub release edit -m "" -a $i "v$version"
if [ $? -ne 0 ];then
exit 1
fi
done
- 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
run: |
python -m twine upload -u ${PYPI_USER} -p ${PYPI_PASSWORD} 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:[email protected]/getgauge/gauge-repository.git" master