0.1.2 #27
Workflow file for this run
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: release cli | |
env: | |
BUILD_PATH: './cli/' | |
permissions: | |
contents: write | |
on: | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: release-cli | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install asdf & tools | |
uses: asdf-vm/actions/install@v3 | |
- name: Install deps | |
working-directory: ${{ env.BUILD_PATH }} | |
run: | | |
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest | |
go install github.com/goreleaser/goreleaser@latest | |
asdf reshim | |
- name: Compile cli binaries | |
working-directory: ${{ env.BUILD_PATH }} | |
run: | | |
make proto | |
goreleaser release --skip=publish --snapshot --clean | |
./scripts/create-main-npm-package.sh | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Publish npm packages | |
working-directory: ${{ env.BUILD_PATH }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
./scripts/publish-npm-packages.sh | |
- name: Upload Release Assets | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const fs = require('fs').promises; | |
const path = require('path'); | |
const dir = './cli/dist'; | |
const files = await fs.readdir(dir); | |
for (const file of files) { | |
if (file.endsWith('.tgz')) { | |
console.log(`Uploading ${file}...`); | |
const filePath = path.join(dir, file); | |
await github.rest.repos.uploadReleaseAsset({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
release_id: context.payload.release.id, | |
name: file, | |
data: await fs.readFile(filePath) | |
}); | |
} | |
} | |
- name: Upload Checksum File | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const fs = require('fs').promises; | |
await github.rest.repos.uploadReleaseAsset({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
release_id: context.payload.release.id, | |
name: 'checksums.txt', | |
data: await fs.readFile('./cli/dist/checksums.txt') | |
}); |