Skip to content

chore: fix package.json repository field #11

chore: fix package.json repository field

chore: fix package.json repository field #11

Workflow file for this run

name: Release and Publish
on:
push:
branches:
- main
permissions:
id-token: write
contents: write
packages: write
jobs:
version-bump:
name: Bump Version
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.bump.outputs.new_version }}
new_tag: ${{ steps.bump.outputs.new_tag }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Bump version
id: bump
run: |
cd cli
npm version patch --no-git-tag-version
NEW_VERSION=$(node -p "require('./package.json').version")
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "new_tag=v$NEW_VERSION" >> $GITHUB_OUTPUT
cd ..
# Update root package.json version to match
npm version $NEW_VERSION --no-git-tag-version --allow-same-version
git add cli/package.json package.json package-lock.json cli/package-lock.json
git commit -m "chore: bump version to $NEW_VERSION"
git tag "v$NEW_VERSION"
git push origin main
git push origin "v$NEW_VERSION"
build-binaries:
name: Build Binary (${{ matrix.goos }}-${{ matrix.goarch }})
needs: version-bump
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- runner: ubuntu-latest
goos: linux
goarch: amd64
artifact: facet-linux-amd64
- runner: ubuntu-24.04-arm
goos: linux
goarch: arm64
artifact: facet-linux-arm64
- runner: macos-14
goos: darwin
goarch: arm64
artifact: facet-darwin-arm64
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ needs.version-bump.outputs.new_tag }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.25"
- name: Install npm dependencies
run: |
npm install
cd cli && npm install
- name: Create tarball
run: |
tar czf cmd/facet/facet-cli.tar.gz \
--exclude='cli/dist' --exclude='cli/test' --exclude='cli/.git' \
cli/src cli/vite-ssr-loader.ts cli/package.json cli/node_modules \
package.json src/styles.css
- name: Build Go binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
go build \
-ldflags "-X main.version=${{ needs.version-bump.outputs.new_version }} -X main.commit=$(git rev-parse --short HEAD)" \
-o dist/${{ matrix.artifact }} \
./cmd/facet
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: dist/${{ matrix.artifact }}
retention-days: 1
create-release:
name: Create GitHub Release
needs: [version-bump, build-binaries]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: binaries
- name: Display structure of downloaded files
run: ls -R binaries
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ needs.version-bump.outputs.new_tag }} \
--repo ${{ github.repository }} \
--title "Release ${{ needs.version-bump.outputs.new_tag }}" \
--notes "Release ${{ needs.version-bump.outputs.new_version }}" \
binaries/facet-linux-amd64/facet-linux-amd64 \
binaries/facet-linux-arm64/facet-linux-arm64 \
binaries/facet-darwin-arm64/facet-darwin-arm64
publish-npm:
name: Publish to npm
needs: [version-bump, build-binaries]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ needs.version-bump.outputs.new_tag }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: |
npm install
cd cli
npm install
- name: Build CLI
run: npm run build:cli
- name: Publish to npm
run: npm publish --access public