Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add CLI assets to release #1447

Merged
merged 18 commits into from
Apr 30, 2024
49 changes: 49 additions & 0 deletions .github/workflows/release-cli-assets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Release CLI Assets

on:
workflow_call:

jobs:
release-cli-assets:
name: Release CLI assets
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
# This makes the PR pushed to use GITHUB_TOKEN and trigger the checks
persist-credentials: false

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Use Node.js ${{ steps.config.outputs.NVMRC }}
uses: actions/setup-node@v3
with:
node-version: ${{ steps.config.outputs.NVMRC }}
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm build

- name: Install windows dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y nsis
sudo apt-get install -y p7zip

- name: Release CLI Assets
run: pnpm run release:cli
env:
MATRIX_OS: ${{ matrix.os }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:

- name: Create Release Pull Request or Publish to npm
uses: changesets/action@v1
id: changesets
if: github.ref_name == 'main'
with:
title: Release tracking
Expand All @@ -65,3 +66,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish CLI assets
uses: ./.github/workflows/release-cli-assets.yml
if: steps.changesets.outputs.published == true
9 changes: 9 additions & 0 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@
"hooks": {
"init": "./dist/hooks/init/compatibility"
},
"macos": {
"identifier": "io.xata.cli"
},
"deb": {
"identifier": "io.xata.cli"
},
"win": {
"identifier": "io.xata.cli"
},
"dirname": "xata",
"commands": "./dist/commands",
"plugins": [
Expand Down
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"test": "vitest",
"test:canary": "tsx ./scripts/test-canary.ts",
"release:cli": "tsx ./scripts/release-cli.ts",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"prepare": "husky install",
Expand Down Expand Up @@ -107,5 +108,11 @@
"engines": {
"node": "18.x",
"pnpm": "8.x"
},
"dependencies": {
"@octokit/core": "^6.1.2",
"@pnpm/exportable-manifest": "^6.0.0",
"@pnpm/read-project-manifest": "^6.0.0",
"@pnpm/write-project-manifest": "^6.0.0"
}
}
Loading
Loading