Update Types #6132
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: Update Types | |
on: | |
schedule: | |
- cron: "0 * * * *" | |
workflow_dispatch: | |
permissions: | |
contents: write | |
id-token: write | |
jobs: | |
update_types: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Bun | |
uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: 1.0.30 | |
- name: Clone TBA Schema parser repo | |
run: git clone https://github.com/ark0f/tg-bot-api.git | |
- name: Temporal dirty fix for https://github.com/ark0f/tg-bot-api/issues/20 | |
run: bun dirty-fix | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Use cargo cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
tg-bot-api/target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo- | |
${{ runner.os }}- | |
- name: Generate TBA Schema | |
run: cd tg-bot-api && cargo run --package gh-pages-generator --bin gh-pages-generator -- dev | |
- id: cicd | |
name: Get hash from schema | |
run: bun cicd | |
- name: Generate types | |
run: bun generate | |
- name: Prepare to JSR publish | |
run: bun jsr | |
- name: Commit and Push changes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: "release v${{ steps.cicd.outputs.version }}" | |
- id: changelog | |
name: Generate changelog | |
run: bun scripts/generate-changelog.ts | |
- name: Publish package to JSR | |
run: bunx jsr publish | |
- name: Install Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
registry-url: "https://registry.npmjs.org" | |
scope: "@gramio" | |
- name: Publish package to NPM | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: GitHub Release | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: v${{ steps.cicd.outputs.version }} | |
name: v${{ steps.cicd.outputs.version }} | |
body: ${{ steps.changelog.outputs.changelog }} | |
draft: false | |
prerelease: false | |
generateReleaseNotes: true |