1.0.28 #34
Workflow file for this run
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: | |
workflow_dispatch: | |
release: | |
types: [released] | |
# enforce single job concurrency since we need to push commits | |
concurrency: | |
group: localization-release | |
cancel-in-progress: false | |
env: | |
GIT_AUTHOR_NAME: github-actions[bot] | |
GIT_COMMITTER_NAME: github-actions[bot] | |
GIT_AUTHOR_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com | |
GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com | |
jobs: | |
ts: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
pull-requests: write | |
if: contains(github.ref, 'tags') | |
steps: | |
- uses: actions/checkout@v4 | |
- id: parse-tag | |
run: | | |
echo "VERSION=$(echo ${{ github.ref }} | cut -d '/' -f 3)" >> $GITHUB_ENV | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
registry-url: "https://npm.pkg.github.com" | |
scope: "@superthread-com" | |
- name: Bump version | |
run: npm version $VERSION --no-git-tag-version | |
- name: Check for modified files | |
id: git-check | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "MODIFIED=true" >> $GITHUB_ENV | |
else | |
echo "MODIFIED=false" >> $GITHUB_ENV | |
fi | |
- name: Publish new version | |
if: env.MODIFIED == 'true' | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
npm install --include=dev | |
npm publish | |
- name: update version | |
id: pr | |
if: env.MODIFIED == 'true' | |
env: | |
HEAD: release-$VERSION | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git checkout -b ${{ env.HEAD }} | |
git add package.json | |
git commit -m "[bot] ts release $API $VERSION" | |
git push --set-upstream origin ${{ env.HEAD }} | |
url=$(gh pr create \ | |
--title '[bot] release ${{ env.VERSION }}' \ | |
--body 'This PR bumps the version to ${{ env.VERSION }}') | |
echo "PR_URL=$(echo $url)" >> $GITHUB_ENV | |
gh pr merge --auto --squash "$url" | |
# separate approval step ensures that CI checks will pass before merge | |
- name: approve pr | |
if: env.MODIFIED == 'true' | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh pr review --approve ${{ env.PR_URL }} |