Skip to content

Commit 5145a9d

Browse files
committed
Merge scalar-generated into scalar-next (build 8qvJkmCu0mOKSP6Tk7o0o)
2 parents c4fe6e8 + 4db79b6 commit 5145a9d

3 files changed

Lines changed: 220 additions & 138 deletions

File tree

.github/workflows/release-please.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,12 @@ jobs:
5151
git checkout -B scalar-next origin/scalar-next
5252
git merge --no-edit -m "Sync release ${{ steps.release.outputs.tag_name }} back to scalar-next" "${{ steps.release.outputs.sha }}"
5353
git push origin scalar-next
54+
publish:
55+
needs: release-please
56+
if: ${{ !cancelled() && needs.release-please.outputs.release_created == 'true' }}
57+
permissions:
58+
contents: write
59+
id-token: write
60+
packages: write
61+
uses: ./.github/workflows/sdk-release.yml
62+
secrets: inherit

.github/workflows/sdk-release.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: CLI SDK Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
# Called by release-please.yml at the released commit; the trigger the default
8+
# GITHUB_TOKEN can actually reach (token-created releases never fire `release`).
9+
workflow_call:
10+
11+
permissions:
12+
contents: write
13+
id-token: write
14+
packages: write
15+
16+
jobs:
17+
release:
18+
runs-on: ubuntu-latest
19+
env:
20+
VERSIONING_POLICY: manual
21+
steps:
22+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
23+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
24+
with:
25+
node-version: "20"
26+
- run: npm install
27+
- run: npm run build
28+
# The version is owned by release tooling in this repository, never by the SDK generator,
29+
# so every release step reads it from package.json at run time.
30+
- name: Read package version
31+
run: echo "PKG_VERSION=$(node -p 'require("./package.json").version')" >> "$GITHUB_ENV"
32+
- name: Package release tarball
33+
run: npm pack --pack-destination . && mv "$(ls *.tgz | head -n1)" "scalarapi-${PKG_VERSION}.tgz"
34+
- name: Attach binary to the release
35+
run: gh release upload "v${PKG_VERSION}" "scalarapi-${PKG_VERSION}.tgz" --clobber
36+
env:
37+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
- name: Update Homebrew tap
39+
env:
40+
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
41+
run: |
42+
ASSET_URL="https://github.com/scalar/scalar-cli/releases/download/v${PKG_VERSION}/scalarapi-${PKG_VERSION}.tgz"
43+
curl -fsSL "$ASSET_URL" -o release.tgz
44+
SHA256="$(shasum -a 256 release.tgz | cut -d" " -f1)"
45+
git clone "https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/scalar/scalar-cli-homebrew.git" tap
46+
mkdir -p tap/Formula
47+
cat > "tap/Formula/scalarapi.rb" <<'EOF'
48+
class Scalarapi < Formula
49+
desc "scalarapi command-line interface"
50+
homepage "https://github.com/scalar/scalar-cli"
51+
url "__ASSET_URL__"
52+
sha256 "__SHA256__"
53+
version "__VERSION__"
54+
depends_on "node"
55+
56+
def install
57+
system "npm", "install", *std_npm_args
58+
bin.install_symlink Dir["#{libexec}/bin/*"]
59+
end
60+
61+
test do
62+
system "#{bin}/scalarapi", "--help"
63+
end
64+
end
65+
EOF
66+
sed -e "s|__SHA256__|$SHA256|" -e "s|__ASSET_URL__|$ASSET_URL|" -e "s|__VERSION__|$PKG_VERSION|" "tap/Formula/scalarapi.rb" > "tap/Formula/scalarapi.rb.tmp"
67+
mv "tap/Formula/scalarapi.rb.tmp" "tap/Formula/scalarapi.rb"
68+
cd tap
69+
git config user.name "github-actions[bot]"
70+
git config user.email "github-actions[bot]@users.noreply.github.com"
71+
git add "Formula/scalarapi.rb"
72+
git commit -m "scalarapi ${PKG_VERSION}" || { echo "formula unchanged, skipping"; exit 0; }
73+
git push

0 commit comments

Comments
 (0)