-
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.
- Loading branch information
1 parent
859541b
commit de2cbbd
Showing
4 changed files
with
156 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,113 @@ | ||
name: Pre-Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
inputs: | ||
wants-github-release: | ||
default: false | ||
description: Create a GitHub release? | ||
required: false | ||
type: boolean | ||
|
||
concurrency: pre-release | ||
|
||
env: | ||
DEV_BUILD: true | ||
# renovate: datasource=docker depName=node versioning=node | ||
NODE_VERSION: "20.17.0" | ||
KS_RELEASE_CHANNEL: dev | ||
|
||
jobs: | ||
versions: | ||
name: Versions | ||
outputs: | ||
RELEASE_VERSION: ${{ env.RELEASE_VERSION }} | ||
permissions: | ||
contents: read | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | ||
|
||
- name: Select NodeJS version | ||
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
registry-url: https://registry.npmjs.org | ||
|
||
- name: Determine versions | ||
run: echo "RELEASE_VERSION=$(node scripts/release-version.cjs)" >> $GITHUB_ENV | ||
|
||
qa: | ||
name: 🔹 QA | ||
uses: ./.github/workflows/qa.yml | ||
|
||
pre-release: | ||
if: github.event.commits[1] != null || ( !startsWith(github.event.commits[0].message, 'chore(deps):') && !startsWith(github.event.commits[0].message, 'fix(deps):') ) | ||
needs: | ||
- versions | ||
- qa | ||
permissions: | ||
actions: write | ||
attestations: write | ||
contents: write | ||
id-token: write | ||
packages: write | ||
pull-requests: read | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | ||
|
||
- name: Select NodeJS version | ||
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
registry-url: https://registry.npmjs.org | ||
|
||
- name: Enable Corepack | ||
run: | | ||
corepack enable | ||
yarn config set enableGlobalCache false | ||
- name: Load cached dependencies | ||
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 | ||
with: | ||
path: .yarn/cache | ||
key: ${{ runner.os }}-node${{ env.NODE_VERSION }}-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-node${{ env.NODE_VERSION }} | ||
- name: Install dependencies | ||
run: yarn install | ||
|
||
- name: Build everything | ||
run: yarn build:all | ||
|
||
- name: Build release | ||
run: | | ||
yarn kitten-analysts:release | ||
yarn kitten-engineers:release | ||
yarn kitten-scientists:release | ||
- name: Generate GitHub release | ||
uses: oliversalzburg/action-automatic-semantic-releases@bc429dc1af8c036b5f8c11fef7bcb0becfd5064d # v0.0.13 | ||
with: | ||
automatic_release_tag: next | ||
draft: false | ||
files: | | ||
packages/kitten-scientists/output/* | ||
sbom.spdx.json | ||
prerelease: true | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
title: Development Build v${{ env.KS_VERSION }} | ||
|
||
update-release-info: | ||
name: 🔹 Update Release Info | ||
needs: | ||
- pre-release | ||
uses: ./.github/workflows/release-info.yml |
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 |
---|---|---|
|
@@ -3,6 +3,10 @@ name: QA | |
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- "**" | ||
- "!main" | ||
workflow_call: | ||
|
||
jobs: | ||
qa-commit: | ||
|
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,38 @@ | ||
/** | ||
* Constructs a version number from: | ||
* - the `version` field in the `package.json` in the current working directory | ||
* - the value of `process.env.DEV_BUILD` being `"true"` to indicate a development snapshot build | ||
* - the value of `process.env.NIGHTLY_BUILD` being `"true"` to indicate a nightly snapshot build | ||
* - the value of `process.env.GITHUB_SHA` | ||
* | ||
* Given the context of the Automatic Semantic Releases Action, this script assumes that the `package.json` contains | ||
* a future, unreleased version number, from which to derive snapshot builds version numbers. | ||
* This implies that you would want to bump the version number in your `package.json` right after every tagged release. | ||
*/ | ||
|
||
"use strict"; | ||
|
||
const { resolve } = require("node:path"); | ||
|
||
const manifest = require(resolve("package.json")); | ||
const isDevBuild = String(process.env.DEV_BUILD) === "true"; | ||
const isNightlyBuild = String(process.env.NIGHTLY_BUILD) === "true"; | ||
|
||
function getDateString() { | ||
const date = new Date(); | ||
const year = date.getFullYear(); | ||
const month = `${date.getMonth() + 1}`.padStart(2, "0"); | ||
const day = `${date.getDate()}`.padStart(2, "0"); | ||
return `${year}${month}${day}`; | ||
} | ||
|
||
const versionString = [ | ||
manifest.version, | ||
isDevBuild ? "-dev" : "", | ||
isNightlyBuild ? `-${getDateString()}` : "", | ||
(isDevBuild || isNightlyBuild) && process.env.GITHUB_SHA | ||
? `-${String(process.env.GITHUB_SHA).substring(0, 7)}` | ||
: "", | ||
].join(""); | ||
|
||
process.stdout.write(versionString); |