production #11
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: | |
if: github.event.deployment.environment == 'production' | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: '${{ secrets.GAUGEBOT_GITHUB_TOKEN }}' | |
RUBYGEMS_USER: '${{ secrets.RUBYGEMS_USER }}' | |
RUBYGEMS_PASS: '${{ secrets.RUBYGEMS_PASS }}' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.2 | |
- 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: create packages | |
run: | | |
bundle install | |
bundle exec rake package_all | |
- name: Release on github | |
run: | | |
if [ -z "$version" ]; then | |
version=$(cd deploy && ls gauge-ruby* | head -1 | sed "s/\.[^\.]*$//" | sed "s/gauge-ruby-//" | sed "s/-[a-z]*\.[a-z0-9_]*$//"); | |
fi | |
echo "VERSION=$version" >> $GITHUB_ENV | |
echo "---------------------------" | |
echo "Updating release v$version" | |
echo "---------------------------" | |
echo -e "Gauge Ruby 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-ruby) | |
echo "$release_description" >> desc.txt | |
gh release create --title "Gauge Ruby v${version}" --notes-file ./desc.txt "v${version}" deploy/* | |
- name: Release on ruby gems | |
run: | | |
mkdir -p ~/.gem && curl -u $RUBYGEMS_USER:$RUBYGEMS_PASS https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials && chmod 0600 ~/.gem/credentials | |
cd pkg | |
for i in gauge-ruby*.gem; do gem push $i; done | |
- name: Update metadata in gauge-repository | |
run: | | |
git clone https://github.com/getgauge/gauge-repository.git | |
cd gauge-repository | |
python update_metadata.py ruby $VERSION | |
commit_message=$(echo -e "Update ruby to v$VERSION") | |
git commit -am "$commit_message" | |
git push "https://$GITHUB_ACTOR:[email protected]/getgauge/gauge-repository.git" master |