ci: migrate to fuman

This commit is contained in:
alina 🌸 2024-12-02 08:42:18 +03:00
parent eaa386c148
commit 6a6cff6282
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI
2 changed files with 48 additions and 99 deletions

View file

@ -3,16 +3,13 @@ name: Run release
on: on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
packages:
description: 'Packages to release (comma separated names, `all` or `updated`)'
required: true
default: 'updated'
kind: kind:
description: 'Release kind (major, minor, patch)' description: 'Release kind (major, minor, patch)'
required: true required: true
default: 'patch' default: 'auto'
type: choice type: choice
options: options:
- auto
- major - major
- minor - minor
- patch - patch
@ -27,7 +24,7 @@ jobs:
permissions: permissions:
contents: write contents: write
packages: write packages: write
id-token: write # The OIDC ID token is used for authentication with JSR. id-token: write
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -36,49 +33,24 @@ jobs:
token: ${{ secrets.BOT_PAT }} token: ${{ secrets.BOT_PAT }}
- if: ${{ github.event.inputs.branch != 'master' }} - if: ${{ github.event.inputs.branch != 'master' }}
run: git checkout ${{ github.event.inputs.branch }} run: git checkout ${{ github.event.inputs.branch }}
- uses: ./.github/actions/init - uses: ./.github/actions/init
- uses: denoland/setup-deno@v1
with:
deno-version: '2.0'
- name: Initialize configs - name: Initialize configs
run: | run: |
git config user.name "mtcute-bot" git config user.name "mtcute-bot"
git config user.email mtcute-bot@tei.su git config user.email mtcute-bot@tei.su
npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
- name: Verify NPM token - name: Run release
run: npm whoami
- 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: Build packages and publish to NPM
id: build
env: env:
GH_RELEASE: 1
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: node scripts/publish.js ${{ steps.find.outputs.modified }}
- 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 }}
- name: Commit version bumps
run: | run: |
git commit -am "v${{ steps.bump.outputs.version }}" fuman-build release \
git push --kind=${{ github.event.inputs.kind }} \
- name: GitHub Release --with-npm \
uses: ncipollo/release-action@v1 --npm-token=${{ secrets.NPM_TOKEN }} \
with: --with-jsr \
token: ${{ secrets.GITHUB_TOKEN }} --with-github-release
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

View file

@ -36,12 +36,6 @@ jobs:
node-version: [18.x, 20.x, 22.x] node-version: [18.x, 20.x, 22.x]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Fetch fuman
uses: actions/checkout@v4
with:
repository: teidesu/fuman
path: private/fuman
token: ${{ secrets.BOT_PAT }}
- uses: ./.github/actions/init - uses: ./.github/actions/init
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
@ -59,12 +53,6 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Fetch fuman
uses: actions/checkout@v4
with:
repository: teidesu/fuman
path: private/fuman
token: ${{ secrets.BOT_PAT }}
- uses: ./.github/actions/init - uses: ./.github/actions/init
- uses: oven-sh/setup-bun@v1 - uses: oven-sh/setup-bun@v1
with: with:
@ -78,12 +66,6 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Fetch fuman
uses: actions/checkout@v4
with:
repository: teidesu/fuman
path: private/fuman
token: ${{ secrets.BOT_PAT }}
- uses: ./.github/actions/init - uses: ./.github/actions/init
- uses: denoland/setup-deno@v1 - uses: denoland/setup-deno@v1
with: with:
@ -101,12 +83,6 @@ jobs:
browser: [chromium, firefox] browser: [chromium, firefox]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Fetch fuman
uses: actions/checkout@v4
with:
repository: teidesu/fuman
path: private/fuman
token: ${{ secrets.BOT_PAT }}
- name: 'Build Docker image' - name: 'Build Docker image'
run: docker build . -f .github/Dockerfile.test-web --build-arg BROWSER=${{ matrix.browser }} -t mtcute/test-web run: docker build . -f .github/Dockerfile.test-web --build-arg BROWSER=${{ matrix.browser }} -t mtcute/test-web
- name: 'Run tests' - name: 'Run tests'
@ -126,42 +102,43 @@ jobs:
actions: write actions: write
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Fetch fuman
uses: actions/checkout@v4
with:
repository: teidesu/fuman
path: private/fuman
token: ${{ secrets.BOT_PAT }}
- name: Run end-to-end tests - name: Run end-to-end tests
env: env:
API_ID: ${{ secrets.TELEGRAM_API_ID }} API_ID: ${{ secrets.TELEGRAM_API_ID }}
API_HASH: ${{ secrets.TELEGRAM_API_HASH }} API_HASH: ${{ secrets.TELEGRAM_API_HASH }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: cd e2e/node && ./cli.sh ci run: cd e2e/node && ./cli.sh ci
- name: Publish to canary NPM e2e-deno:
if: github.repository == 'mtcute/mtcute' # do not run on forks runs-on: ubuntu-latest
continue-on-error: true needs: [lint, test-node, test-web, test-bun, test-deno]
permissions:
contents: read
actions: write
steps:
- uses: actions/checkout@v4
- name: Run end-to-end tests under Deno
env: env:
NPM_TOKEN: ${{ secrets.CANARY_NPM_TOKEN }} API_ID: ${{ secrets.TELEGRAM_API_ID }}
API_HASH: ${{ secrets.TELEGRAM_API_HASH }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REGISTRY: 'https://npm.tei.su' uses: nick-fields/retry@v2
run: cd e2e/node && ./cli.sh ci-publish # thanks docker networking very cool
# e2e-deno: with:
# runs-on: ubuntu-latest max_attempts: 3
# needs: [lint, test-node, test-web, test-bun, test-deno] timeout_minutes: 30
# permissions: command: cd e2e/deno && ./cli.sh ci
# contents: read
# actions: write cr:
# steps: needs:
# - uses: actions/checkout@v4 - e2e-deno
# - name: Run end-to-end tests under Deno - e2e
# env: runs-on: ubuntu-latest
# API_ID: ${{ secrets.TELEGRAM_API_ID }} # dont run on forks or release commits
# API_HASH: ${{ secrets.TELEGRAM_API_HASH }} if: github.repository == 'mtcute/mtcute' && github.actor != 'mtcute-bot'
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps:
# uses: nick-fields/retry@v2 - uses: actions/checkout@v4
# # thanks docker networking very cool - uses: ./.github/actions/init
# with: - name: 'publish to pkg.pr.new'
# max_attempts: 3 env:
# timeout_minutes: 30 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# command: cd e2e/deno && ./cli.sh ci run: fuman-build cr