mtcute/.github/workflows/release.yaml

85 lines
2.8 KiB
YAML
Raw Normal View History

2023-10-31 21:17:39 +03:00
name: Run release
on:
workflow_dispatch:
inputs:
packages:
description: 'Packages to release (comma separated names, `all` or `updated`)'
required: true
default: 'updated'
kind:
description: 'Release kind (major, minor, patch)'
required: true
default: 'patch'
type: choice
options:
- major
- minor
- patch
2024-04-27 11:14:52 +03:00
branch:
description: 'Branch to release from'
required: true
default: 'master'
2023-10-31 21:17:39 +03:00
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
2024-05-08 02:44:54 +03:00
id-token: write # The OIDC ID token is used for authentication with JSR.
2023-10-31 21:17:39 +03:00
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.BOT_PAT }}
2024-04-27 11:14:52 +03:00
- if: ${{ github.event.inputs.branch != 'master' }}
run: git checkout ${{ github.event.inputs.branch }}
2023-11-29 20:31:18 +03:00
- uses: ./.github/actions/init
2023-10-31 21:17:39 +03:00
- name: Initialize configs
run: |
git config user.name "mtcute-bot"
git config user.email mtcute-bot@tei.su
npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
2024-03-24 01:31:44 +03:00
- name: Verify NPM token
run: npm whoami
2023-10-31 21:17:39 +03:00
- name: Find packages to publish
id: find
run: node scripts/find-updated-packages.js ${{ inputs.kind }} ${{ inputs.packages }}
- name: Generate changelog
id: changelog
run: node scripts/generate-changelog.js ${{ steps.find.outputs.modified }}
2023-10-31 21:17:39 +03:00
- name: Bump versions
id: bump
run: node scripts/bump-version.js ${{ inputs.kind }} ${{ steps.find.outputs.modified }}
- name: Build packages and publish to NPM
2023-10-31 21:17:39 +03:00
id: build
env:
GH_RELEASE: 1
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2023-10-31 21:17:39 +03:00
run: node scripts/publish.js ${{ steps.find.outputs.modified }}
2024-09-24 23:54:38 +03:00
- uses: denoland/setup-deno@v1
with:
deno-version: '1.46.3'
- name: Build packages and publish to JSR
continue-on-error: true # temporary
env:
JSR: 1
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: node scripts/publish.js ${{ steps.find.outputs.modified }}
2024-03-24 01:31:44 +03:00
- name: Commit version bumps
run: |
git commit -am "v${{ steps.bump.outputs.version }}"
git push
2023-10-31 21:17:39 +03:00
- name: GitHub Release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: v${{ steps.bump.outputs.version }}
name: v${{ steps.bump.outputs.version }}
artifacts: ${{ steps.build.outputs.tarballs }}
body: ${{ steps.changelog.outputs.changelog }}
2023-10-31 21:17:39 +03:00
draft: false
prerelease: false