-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically generate and push releases info to R2 bucket on every r…
…elease (#526)
- Loading branch information
1 parent
32014d7
commit f8657fb
Showing
17 changed files
with
2,068 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: ci-release-info-build | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
- ready_for_review | ||
paths: | ||
- 'tools/release-info/**' | ||
jobs: | ||
build: | ||
if: github.event_name == 'pull_request' | ||
name: build | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: tools/release-info | ||
steps: | ||
- name: Checkout Source | ||
uses: actions/checkout@v4 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ">=22" | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Build | ||
run: npm run build |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: ci-release-info-lint | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
- ready_for_review | ||
paths: | ||
- 'tools/release-info/**' | ||
jobs: | ||
lint: | ||
if: github.event_name == 'pull_request' | ||
name: lint (tools/release-info) | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: tools/release-info | ||
steps: | ||
- name: Checkout Source | ||
uses: actions/checkout@v4 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ">=22" | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Check formatting | ||
run: npm run pretty:check | ||
- name: Lint | ||
run: npm run lint |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Generate Release Info | ||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
permissions: | ||
contents: read | ||
jobs: | ||
release-info: | ||
runs-on: warp-ubuntu-latest-x64-2x | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: "${{ github.ref_name }}" | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ">=22" | ||
registry-url: "https://registry.npmjs.org" | ||
- name: Install Dependencies | ||
working-directory: tools/release-info | ||
run: npm ci | ||
- name: Build | ||
working-directory: tools/release-info | ||
run: npm run build | ||
- name: Run | ||
working-directory: tools/release-info | ||
run: node dist/index.js | ||
- name: Push to R2 Bucket | ||
uses: cloudflare/wrangler-action@v3 | ||
with: | ||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
apiToken: ${{ secrets.CLOUDFLARE_TOKEN }} | ||
wranglerVersion: "3.83.0" | ||
workingDirectory: "tools/release-info" | ||
preCommands: | | ||
cat modus-latest.json | ||
cat modus-preview.json | ||
cat modus-all.json | ||
cat modus-preview-all.json | ||
command: | | ||
r2 object put releases/modus-latest.json -f modus-latest.json --content-type application/json | ||
r2 object put releases/modus-preview.json -f modus-preview.json --content-type application/json | ||
r2 object put releases/modus-all.json -f modus-all.json --content-type application/json | ||
r2 object put releases/modus-preview-all.json -f modus-preview-all.json --content-type application/json |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist/ | ||
modus-*.json |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"singleQuote": false, | ||
"printWidth": 1024 | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright 2024 Hypermode Inc. | ||
* Licensed under the terms of the Apache License, Version 2.0 | ||
* See the LICENSE file that accompanied this code for further details. | ||
* | ||
* SPDX-FileCopyrightText: 2024 Hypermode Inc. <[email protected]> | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export const GitHubOwner = "hypermodeinc"; | ||
export const GitHubRepo = "modus"; | ||
export const GitHubRuntimeTagPrefix = "runtime/"; | ||
export const GitHubCliTagPrefix = "cli/"; | ||
|
||
export function GetSdkTagPrefix(sdk: SDK): string { | ||
return `sdk/${sdk.toLowerCase()}/`; | ||
} | ||
|
||
export enum SDK { | ||
AssemblyScript = "AssemblyScript", | ||
Go = "Go", | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// @ts-check | ||
|
||
import eslint from "@eslint/js"; | ||
import tseslint from "typescript-eslint"; | ||
|
||
export default tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommended); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright 2024 Hypermode Inc. | ||
* Licensed under the terms of the Apache License, Version 2.0 | ||
* See the LICENSE file that accompanied this code for further details. | ||
* | ||
* SPDX-FileCopyrightText: 2024 Hypermode Inc. <[email protected]> | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { getLatestSdkVersion, getLatestRuntimeVersion, getLatestCliVersion, getAllSdkVersions, getAllRuntimeVersions, getAllCliVersions } from "./versioninfo.js"; | ||
import { SDK } from "./constants.js"; | ||
import { writeFile } from "fs/promises"; | ||
|
||
async function buildModusLatestJSON(filename: string, includePrerelease: boolean) { | ||
const as = await getLatestSdkVersion(SDK.AssemblyScript, includePrerelease); | ||
const go = await getLatestSdkVersion(SDK.Go, includePrerelease); | ||
const cli = await getLatestCliVersion(includePrerelease); | ||
const runtime = await getLatestRuntimeVersion(includePrerelease); | ||
const info = { | ||
"sdk/assemblyscript": as, | ||
"sdk/go": go, | ||
cli: cli, | ||
runtime: runtime, | ||
}; | ||
|
||
await writeFile(filename, JSON.stringify(info, null, 2)); | ||
} | ||
|
||
async function buildModusAllJSON(filename: string, includePrerelease: boolean) { | ||
const as = await getAllSdkVersions(SDK.AssemblyScript, includePrerelease); | ||
const go = await getAllSdkVersions(SDK.Go, includePrerelease); | ||
const cli = await getAllCliVersions(includePrerelease); | ||
const runtime = await getAllRuntimeVersions(includePrerelease); | ||
const info = { | ||
"sdk/assemblyscript": as, | ||
"sdk/go": go, | ||
cli: cli, | ||
runtime: runtime, | ||
}; | ||
await writeFile(filename, JSON.stringify(info, null, 2)); | ||
} | ||
|
||
await buildModusLatestJSON("modus-latest.json", false); | ||
await buildModusLatestJSON("modus-preview.json", true); | ||
await buildModusAllJSON("modus-all.json", false); | ||
await buildModusAllJSON("modus-preview-all.json", true); |
Oops, something went wrong.