Skip to content

fix: yaml syntax in github actions workflows #2

fix: yaml syntax in github actions workflows

fix: yaml syntax in github actions workflows #2

Workflow file for this run

name: Dev Release (main)
on:
push:
branches: [main]
concurrency:
group: dev-release-${{ github.ref }}
cancel-in-progress: false
jobs:
compute-version:
runs-on: ubuntu-latest
outputs:
dev_version: ${{ steps.version.outputs.dev_version }}
tag_name: ${{ steps.version.outputs.tag_name }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.18.1'
- name: Compute dev version
id: version
run: |
BASE_VERSION=$(node -p "require('./package.json').version")
DEV_VERSION="${BASE_VERSION}-dev.${{ github.run_number }}"
echo "dev_version=${DEV_VERSION}" >> "${GITHUB_OUTPUT}"
echo "tag_name=v${DEV_VERSION}" >> "${GITHUB_OUTPUT}"
echo "Dev version: ${DEV_VERSION}"
build-binaries:
needs: compute-version
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: bun-linux-x64
asset: kode-linux-x64
- os: ubuntu-latest
target: bun-linux-arm64
asset: kode-linux-arm64
- os: macos-latest
target: bun-darwin-x64
asset: kode-darwin-x64
- os: macos-latest
target: bun-darwin-arm64
asset: kode-darwin-arm64
- os: windows-latest
target: bun-windows-x64
asset: kode-win32-x64.exe
runs-on: ${{ matrix.os }}
env:
KODE_SKIP_BINARY_DOWNLOAD: "1"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.18.1'
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install
run: bun install
- name: Set package.json version (dev)
run: node -e "const fs=require('fs');const p=JSON.parse(fs.readFileSync('package.json'));p.version='${{ needs.compute-version.outputs.dev_version }}';fs.writeFileSync('package.json',JSON.stringify(p,null,2)+'\n')"
- name: Build binary
run: bun build src/entrypoints/index.ts --compile --target=${{ matrix.target }} --format=esm --outfile=${{ matrix.asset }}
- name: Make binary executable
if: runner.os != 'Windows'
run: chmod +x ${{ matrix.asset }}
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset }}
path: ${{ matrix.asset }}
if-no-files-found: error
publish-npm:
needs: compute-version
runs-on: ubuntu-latest
env:
KODE_SKIP_BINARY_DOWNLOAD: "1"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.18.1'
registry-url: 'https://registry.npmjs.org'
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install
run: bun install
- name: Set package.json version (dev)
run: node -e "const fs=require('fs');const p=JSON.parse(fs.readFileSync('package.json'));p.version='${{ needs.compute-version.outputs.dev_version }}';fs.writeFileSync('package.json',JSON.stringify(p,null,2)+'\n')"
- name: Typecheck
run: bun run typecheck
- name: Test
run: bun test
- name: Build (npm)
run: bun run build:npm
- name: Prepublish check
run: bun run scripts/prepublish-check.js
- name: "Publish npm (dist-tag: dev)"
run: npm publish --tag dev --access public --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
prerelease:
needs: [compute-version, build-binaries, publish-npm]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download binary artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create checksums
run: |
find artifacts -type f -maxdepth 2 -print0 | sort -z | xargs -0 shasum -a 256 > checksums-sha256.txt
echo "Checksums:"
head -n 20 checksums-sha256.txt
- name: Create GitHub prerelease
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.compute-version.outputs.tag_name }}
name: ${{ needs.compute-version.outputs.tag_name }}
prerelease: true
files: |
artifacts/**/*
checksums-sha256.txt