mtcute/.github/workflows/release.yaml

65 lines
2 KiB
YAML

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
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.BOT_PAT }}
- uses: ./.github/actions/init
- 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 }}
- 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 }}
- name: Bump versions
id: bump
run: node scripts/bump-version.js ${{ inputs.kind }} ${{ steps.find.outputs.modified }}
- name: Commit version bumps
run: |
git commit -am "v${{ steps.bump.outputs.version }}"
git push
- name: Build packages and publish to NPM
id: build
env:
GH_RELEASE: 1
run: node scripts/publish.js ${{ steps.find.outputs.modified }}
- 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 }}
draft: false
prerelease: false