production #67
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: deployment | |
jobs: | |
release: | |
if: github.event.deployment.environment == 'production' | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: '${{ secrets.GAUGEBOT_GITHUB_TOKEN }}' | |
NPM_TOKEN: '${{ secrets.NPM_TOKEN }}' | |
CI: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
registry-url: 'https://registry.npmjs.org' | |
- 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: Install dependencies | |
run: | | |
npm install | |
- name: Package | |
working-directory: gauge-ts | |
run: | | |
npm run build | |
./build.sh package | |
- name: Deploy on github | |
working-directory: gauge-ts | |
run: | | |
cd artifacts | |
version=$(ls gauge-ts* | head -1 | sed "s/\.[^\.]*$//" | sed "s/gauge-ts-//" | sed "s/-[a-z]*\.[a-z0-9_]*$//"); | |
if [ -z "$version" ]; then | |
echo "version is not set" | |
exit 1 | |
fi | |
echo "VERSION=$version" >> $GITHUB_ENV | |
echo -e "gauge-ts 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-ts) | |
echo "$release_description" >> desc.txt | |
gh release create --title "Gauge Typescript v${version}" --notes-file ./desc.txt "v${version}" gauge-ts* | |
- name: Deploy npm | |
working-directory: gauge-ts | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
npm publish --access=public | |
- name: Update metadata in gauge-repository | |
run: | | |
git clone https://github.com/getgauge/gauge-repository.git | |
cd gauge-repository | |
python update_metadata.py ts $VERSION | |
commit_message=$(echo -e "Update ts to v$VERSION") | |
git commit -am "$commit_message" | |
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/getgauge/gauge-repository.git" master |