production #52
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: | |
deploy: | |
if: github.event.deployment.environment == 'production' | |
runs-on: ubuntu-latest | |
env: | |
MAVEN_GPG_SIGN_KEY: '${{ secrets.MAVEN_GPG_SIGN_KEY }}' | |
username: '${{ secrets.maven_deploy_username }}' | |
password: '${{ secrets.maven_deploy_password }}' | |
passphrase: '${{ secrets.gpg_passphrase }}' | |
GITHUB_TOKEN: '${{ secrets.GAUGEBOT_GITHUB_TOKEN }}' | |
CI: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Set up Maven | |
uses: stCarolas/setup-maven@v5 | |
with: | |
maven-version: 3.9.9 | |
- name: Setup maven | |
run: | | |
echo -e "$MAVEN_GPG_SIGN_KEY" | gpg --import --batch - | |
gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys $gpgkey | |
rm -rf $HOME/.m2 | |
mkdir -p $HOME/.m2 | |
echo -e "<settings>\n<servers>\n<server>\n<id>ossrh</id>\n<username>$username</username>\n<password>$password</password>\n</server>\n</servers>\n</settings>" > $HOME/.m2/settings.xml | |
- 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: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
check-latest: true | |
go-version-file: 'go.mod' | |
- name: Build artifacts | |
run: go run build/make.go --all-platforms && go run build/make.go --all-platforms --distro | |
shell: bash | |
- name: Deploy on github | |
run: | | |
if [ -z "$version" ]; then | |
version=$(cd deploy && ls gauge-java* | head -1 | sed "s/\.[^\.]*$//" | sed "s/gauge-java-//" | sed "s/-[a-z]*\.[a-z0-9_]*$//") | |
fi | |
echo "VERSION=$version" >> $GITHUB_ENV | |
echo "---------------------------" | |
echo "Updating release v$version" | |
echo "---------------------------" | |
echo -e "Gauge Java 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-java) | |
echo "$release_description" >> desc.txt | |
gh release create --title "Gauge Java v${version}" --notes-file ./desc.txt "v${version}" deploy/gauge-java* | |
- name: Deploy on maven central | |
run: | | |
mvn -q clean deploy -Dgpg.passphrase=$passphrase | |
- name: Update metadata in gauge-repository | |
run: | | |
git clone https://github.com/getgauge/gauge-repository.git | |
cd gauge-repository | |
python update_metadata.py java $VERSION | |
commit_message=$(echo -e "Update java to v$VERSION") | |
git commit -am "$commit_message" | |
git push "https://$GITHUB_ACTOR:[email protected]/getgauge/gauge-repository.git" master |