Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: setup nightly release #524

Merged
merged 38 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
602f6b2
chore: lint and cleanup of touched files
goetzrobin Dec 2, 2024
623df5c
build: add executor to replace version for ui libs
goetzrobin Dec 2, 2024
5ce2660
build: update cli files to reflect new versions and add scripts to ma…
goetzrobin Dec 2, 2024
653d026
chore: fix linting errors
goetzrobin Dec 2, 2024
259d29d
build: update semantic release config
goetzrobin Dec 2, 2024
14c3863
build: use same VERSION env var for ui and cli
goetzrobin Dec 2, 2024
100fc80
fix: remove confusing comment
goetzrobin Dec 3, 2024
601e3a0
fix: add regex only updating spartan specific versions
goetzrobin Dec 3, 2024
6d6e9e4
fix: remove .DS_Store files and filter helm packages to not add them …
goetzrobin Dec 9, 2024
d4b4de8
chore: remove unused script
goetzrobin Dec 2, 2024
bf7e8d6
chore: add generator that auto-increments current version of released…
goetzrobin Dec 2, 2024
792fbd6
chore: add scripts for nightly release
goetzrobin Dec 2, 2024
295b5f1
chore: add nightly release workflow
goetzrobin Dec 2, 2024
242a049
fix: add missing dash
goetzrobin Dec 2, 2024
74bb0a4
chore: try on push for testing
goetzrobin Dec 2, 2024
9425483
build: auto fix version number in tools
goetzrobin Dec 9, 2024
bc2fb57
ci: set up automatic release and committing of changed files
goetzrobin Dec 9, 2024
91b6191
ci: give release step write permissions
goetzrobin Dec 9, 2024
a2919b3
ci: check out branch correctly so we can commit it back
goetzrobin Dec 9, 2024
f389521
ci: try to push to right place
goetzrobin Dec 9, 2024
0c575e8
chore: reorder package.json
goetzrobin Dec 10, 2024
fd21a04
fix: use newVersion to allow for auto increment script to work
goetzrobin Dec 10, 2024
f269e23
chore: update branch name
goetzrobin Dec 10, 2024
b1d7e9b
fix: rename release scripts and interface and add missing generators
goetzrobin Dec 10, 2024
ca511a9
chore: release cli & ui 0.0.1-alpha.379
goetzrobin Dec 10, 2024
b89d5de
chore: fix name for trigger
goetzrobin Dec 10, 2024
7a6fe27
chore: try to push to origin nightly-release
goetzrobin Dec 10, 2024
45c8b28
chore: nightly release 2024-12-10 ⚡
Dec 10, 2024
8c02897
chore: update tools version number
goetzrobin Dec 10, 2024
0fac359
chore: nightly release 2024-12-10 ⚡
Dec 10, 2024
99678f0
chore: update github flow to work on main and a schedule
goetzrobin Dec 10, 2024
6a61b02
fix: add back lost test and start commands to package.json
goetzrobin Dec 10, 2024
18ccabf
fix: fix tests and commit message to follow guidelines
goetzrobin Dec 11, 2024
d8b3a60
feat: adjust version replacement for new single brain package
goetzrobin Jan 7, 2025
19cc514
fix: use correct alpha version 381
goetzrobin Jan 8, 2025
d2d050f
fix: add back storybook command to package.json
goetzrobin Jan 8, 2025
1427755
fix: typo in @spartan-ng/brain version for pagination helm
goetzrobin Jan 8, 2025
3c029b9
fix: remove tests that don't do anything and add formatting of files
goetzrobin Jan 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 128 additions & 0 deletions .github/workflows/nightly-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: nightly-release

on:
schedule:
- cron: '0 0 * * *'

jobs:
check_date:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v2
- name: print latest_commit
run: echo ${{ github.sha }}

- id: should_run
continue-on-error: true
name: check latest commit is less than a day
if: ${{ github.event_name == 'schedule' }}
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false"

commitlint:
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false' }}

runs-on: ubuntu-latest
permissions:
actions: read
contents: read
# Required by wagoid/commitlint-github-action
pull-requests: read
steps:
- uses: actions/checkout@v4
with:
# Required by wagoid/commitlint-github-action
fetch-depth: 0
- name: Install Node v22
uses: actions/setup-node@v4
with:
node-version-file: .node-version
- name: Install pnpm globally
run: npm install -g pnpm
- name: Lint commit messages
uses: wagoid/commitlint-github-action@v5
with:
failOnWarnings: true
helpURL: https://github.com/goetzrobin/spartan/blob/main/CONTRIBUTING.md#-commit-message-guidelines

format-and-lint:
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false' }}

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Required by wagoid/commitlint-github-action
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: .node-version
- name: Install PNPM globally
run: npm install -g pnpm
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: lint
run: pnpm run lint
- name: format
run: pnpm nx format:check --base=origin/main

build:
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false' }}

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Required by wagoid/commitlint-github-action
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: .node-version
- name: Install PNPM globally
run: npm install -g pnpm
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm run build

release:
needs:
- check_date
- build
- format-and-lint
if: ${{ needs.check_date.outputs.should_run != 'false' }}

runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
# Required by wagoid/commitlint-github-action
fetch-depth: 0
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v4
with:
node-version-file: .node-version
- name: Install PNPM globally
run: npm install -g pnpm
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Pre Release
run: pnpm run pre-nightly-release
- name: Get the current date time
id: datetime
run: echo "release_date=$(date '+%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
author_name: Leonidas
author_email: [email protected]
message: 'chore: nightly release ${{steps.datetime.outputs.release_date}} ⚡'
- name: Release
run: pnpm run release
24 changes: 0 additions & 24 deletions .github/workflows/release.yml

This file was deleted.

2 changes: 1 addition & 1 deletion libs/brain/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spartan-ng/brain",
"version": "0.0.1-alpha.357",
"version": "0.0.1-alpha.381",
"sideEffects": false,
"exports": {
"./hlm-tailwind-preset": {
Expand Down
2 changes: 1 addition & 1 deletion libs/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spartan-ng/cli",
"version": "0.0.1-alpha.367",
"version": "0.0.1-alpha.381",
"type": "commonjs",
"dependencies": {
"@nx/angular": ">=20.0.0",
Expand Down
2 changes: 1 addition & 1 deletion libs/cli/src/generators/base/versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export const FALLBACK_ANGULAR_VERSION = '^18.0.0';
// ng-icon dependency
export const NG_ICONS_VERSION = '^29.10.0';
// spartan dependencies
export const SPARTAN_BRAIN_VERSION = '0.0.1-alpha.357';
export const SPARTAN_BRAIN_VERSION = '0.0.1-alpha.381';
// dev dependencies
export const TAILWIND_MERGE_VERSION = '^2.2.0';
export const TAILWINDCSS_VERSION = '^3.0.2';
Expand Down
13 changes: 9 additions & 4 deletions libs/cli/src/generators/ui/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ export default async function hlmUIGenerator(tree: Tree, options: HlmUIGenerator
const config = await getOrCreateConfig(tree, {
componentsPath: options.directory,
});
const availablePrimitives: ComponentDefintions = await import('./supported-ui-libraries.json').then((m) => m.default);
const availablePrimitives: PrimitiveDefinitions = await import('./supported-ui-libraries.json').then(
(m) => m.default,
);
const availablePrimitiveNames = [...Object.keys(availablePrimitives), 'collapsible', 'menubar', 'contextmenu'];
let response: { primitives: string[] } = { primitives: [] };
if (options.name && availablePrimitiveNames.includes(options.name)) {
Expand All @@ -35,7 +37,7 @@ async function createPrimitiveLibraries(
primitives: string[];
},
availablePrimitiveNames: string[],
availablePrimitives: ComponentDefintions,
availablePrimitives: PrimitiveDefinitions,
tree: Tree,
options: HlmUIGeneratorSchema & { angularCli?: boolean },
config: Config,
Expand All @@ -59,7 +61,7 @@ async function createPrimitiveLibraries(
if (primitiveName === 'collapsible') return;

const internalName = availablePrimitives[primitiveName].internalName;
const peerDependencies = availablePrimitives[primitiveName].peerDependencies;
const peerDependencies = removeHelmKeys(availablePrimitives[primitiveName].peerDependencies);
const { generator } = await import(
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
Expand Down Expand Up @@ -108,7 +110,10 @@ const replaceContextAndMenuBar = async (primtivesToCreate: string[], silent = fa
}
};

interface ComponentDefintions {
const removeHelmKeys = (obj: Record<string, string>) =>
Object.fromEntries(Object.entries(obj).filter(([key]) => !key.toLowerCase().includes('helm')));

interface PrimitiveDefinitions {
[componentName: string]: {
internalName: string;
peerDependencies: Record<string, string>;
Expand Down
Loading
Loading