Skip to content

Release

Release #22

Workflow file for this run

---
name: Release
on:
workflow_dispatch:
jobs:
release:
name: Release
runs-on: ubuntu-24.04
permissions:
contents: write
issues: write
pull-requests: write
steps:
- uses: actions/[email protected]
id: app-token
with:
app-id: ${{ secrets.BOT_GH_APP_ID }}
private-key: ${{ secrets.BOT_GH_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: |
typescript-sdk
- name: Get GitHub App User ID
id: get-user-id
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Set up Git
run: |
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
git config --global commit.gpgsign false
git config --global commit.signoff true
- uses: actions/[email protected]
with:
ref: ${{ github.ref }}
fetch-depth: 0
persist-credentials: false
token: ${{ steps.app-token.outputs.token }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Install project dependencies
run: npm ci
- name: Install semantic release and plugins
run: |
npm install -g [email protected] \
conventional-changelog-cli \
conventional-changelog-conventionalcommits \
@semantic-release/changelog \
@semantic-release/git \
@semantic-release/github \
@semantic-release/npm
- name: Create a release if needed
id: semantic
env:
CI: true
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
GIT_AUTHOR_NAME: 'GitHub Actions Bot'
GIT_AUTHOR_EMAIL: ${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com
GIT_COMMITTER_NAME: 'GitHub Actions Bot'
GIT_COMMITTER_EMAIL: ${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
# Create first release if not exists using gh cli - Initial Release Version 0.1.0
# This is an HACK because semantic release doesn't support versions under 1.0.0
# But if we already have a release then it respects it and start to increment from there
if ! gh release view v0.1.0 >/dev/null 2>&1; then
gh release create v0.1.0 --title "Initial Release" --notes "Initial Release" --target main
fi
# Run semantic release
semantic-release