Release CI #8
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 CI | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
type: string | |
description: Precise a GitHub release version. | |
required: true | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- name: Install dependencies | |
run: bun install | |
- name: Run linting | |
run: bun run lint | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
needs: [lint] | |
steps: | |
- name: Generate token | |
id: generate_token | |
uses: getsentry/[email protected] | |
with: | |
app_id: ${{ secrets.DEEPSQUARE_BOT_APP_ID }} | |
private_key: ${{ secrets.DEEPSQUARE_BOT_APP_PRIVATE_KEY }} | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ steps.generate_token.outputs.token }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
registry-url: https://registry.npmjs.org | |
- uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- name: Install dependencies | |
run: bun install | |
- name: Run build | |
run: bun run build | |
- name: Git config | |
run: | | |
git config --global user.name "deepsquare-bot[bot]" | |
git config --global user.email "${{ secrets.DEEPSQUARE_BOT_APP_ID }}+deepsquare-bot[bot]@users.noreply.github.com" | |
- name: Bump version and retag | |
env: | |
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | |
run: | | |
git push origin --delete ${{ inputs.version }} || true | |
npm version ${{ inputs.version }} --allow-same-version | |
git push origin && git push --tags | |
- uses: sersoft-gmbh/setup-gh-cli-action@v2 | |
with: | |
version: stable | |
- name: Create release and upload binaries | |
run: | | |
gh release create ${{ inputs.version }} -t ${{ inputs.version }} --generate-notes | |
env: | |
GH_TOKEN: ${{ steps.generate_token.outputs.token }} | |
- name: Publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
export TAG_NAME="${{ inputs.version }}" | |
TAG=$(node -e 'console.log(process.env.TAG_NAME.includes("-rc") || process.env.TAG_NAME.includes("-beta") || process.env.TAG_NAME.includes("-alpha") ? "next" : "latest")') | |
npm publish --tag $TAG |