production #18
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: Release on PR Merge | |
on: deployment | |
jobs: | |
release-and-bump-version: | |
if: github.event.deployment.environment == 'production' | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: '${{ secrets.GAUGEBOT_GITHUB_TOKEN }}' | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Setup go 1.19 | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '>=1.19.0' | |
- name: build | |
run: | | |
go run build/make.go --all-platforms | |
go run build/make.go --all-platforms --distro | |
- 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: Deploy | |
run: | | |
cd deploy | |
if [ -z "$version" ]; then | |
version=$(ls html-report* | head -1 | sed "s/\.[^\.]*$//" | sed "s/html-report-//" | 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 "HTML Report 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 html-report) | |
echo "$release_description" >> desc.txt | |
echo "Creating new draft for release v$version" | |
hub release create -F ./desc.txt "v$version" | |
sleep 10 | |
rm -rf desc.txt | |
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: Update metadata in gauge-repository | |
run: | | |
git clone https://github.com/getgauge/gauge-repository.git | |
cd gauge-repository | |
python update_metadata.py html-report $VERSION | |
commit_message=$(echo -e "Update html-report to v$VERSION") | |
git commit -am "$commit_message" | |
git push "https://$GITHUB_ACTOR:[email protected]/getgauge/gauge-repository.git" master | |
- name: Bump up version | |
run: | | |
git clean -dfx | |
git checkout master && git checkout . && git pull --rebase | |
version=$(python update_version.py) | |
git commit -am "Bumping up -> $version" | |
git push "https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY.git" master |