chore: setup ci workflow #6

Merged
anavarro merged 1 commit from test/ci-cd into feature/core-library 2024-10-24 16:28:48 -03:00
8 changed files with 108 additions and 10 deletions

View file

@ -0,0 +1,49 @@
name: Publish package
on:
push:
workflow_dispatch:
env:
NPM_TAG: ${{ github.ref == 'refs/heads/main' && 'latest' || 'next' }}
# Variables reference: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#about-contexts
# Syntax reference: https://forgejo.org/docs/latest/user/actions/
jobs:
build_and_publish:
runs-on: docker
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache Bun dependencies
id: cache
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Setup Bun
id: "setup_bun"
uses: oven-sh/setup-bun@v2
- name: Setup Cog
uses: https://github.com/eshepelyuk/cocogitto-diya@v1
with:
release: false
git-user: 'Cog Bot'
git-user-email: 'cog@alecodes.page'
- name: Create release
id: bump
env:
NPM_REGISTRY_TOKEN: ${{ secrets.NPM_TOKEN_FORGEJO }}
run: "cog bump --auto"
- name: Summary
run: |
echo "Bun executable chache found: ${{ steps.setup_bun.outputs.cache-hit }}";
echo "Bun dependencies chache found: ${{ steps.cache.outputs.cache-hit }}";
echo "Package published: ${{ steps.publish.outputs.version }}";

BIN
bun.lockb

Binary file not shown.

4
bunfig.toml Normal file
View file

@ -0,0 +1,4 @@
[install.scopes]
"@alecodes" = { token = "$NPM_REGISTRY_TOKEN", url = "https://git.alecodes.page/api/packages/alecodes/npm/" }
"@mini-strap" = { token = "$NPM_REGISTRY_TOKEN", url = "https://git.alecodes.page/api/packages/alecodes/npm/" }

32
cog.toml Normal file
View file

@ -0,0 +1,32 @@
from_latest_tag = true
ignore_merge_commits = false
disable_changelog = false
disable_bump_commit = false
tag_prefix = "v"
generate_mono_repository_global_tag = true
branch_whitelist = []
skip_ci = "[skip ci]"
skip_untracked = false
pre_bump_hooks = []
post_bump_hooks = []
pre_package_bump_hooks = [
"echo 'bump package {{package}} to {{version}}'",
"sed -E -i 's/(\"version\":) \"[0-9.]{5}\"/\\1 \"{{version}}\"/gi' package.json",
"bun run ci:publish",
]
post_package_bump_hooks = []
[git_hooks]
[commit_types]
[changelog]
path = "CHANGELOG.md"
authors = []
[bump_profiles]
[packages]
"@mini-strap/core" = { path = "packages/core" }
"@mini-strap/components" = { path = "packages/components" }
"@mini-strap/website" = { path = "packages/website", public_api = false }

View file

@ -1,6 +1,8 @@
{ {
"name": "mini-strap", "name": "@alecodes/mini-strap",
"version": "0.0.1",
"module": "index.ts", "module": "index.ts",
"private": true,
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.10.0", "@eslint/js": "^9.10.0",
"@types/bun": "latest", "@types/bun": "latest",
@ -14,8 +16,12 @@
"typescript": "^5.0.0" "typescript": "^5.0.0"
}, },
"scripts": { "scripts": {
"dev": "bun --filter '*' dev" "dev": "bun --filter '*' dev",
"ci:publish": "bun --filter '**/core' ci:publish",
"bump": "cog bump --auto --skip-untracked"
}, },
"type": "module", "type": "module",
"workspaces": ["packages/*"] "workspaces": [
"packages/*"
]
} }

View file

@ -1,7 +1,11 @@
{ {
"name": "mini-strap-components", "name": "@mini-strap/components",
"version": "0.0.1",
"module": "src/components.scss", "module": "src/components.scss",
"type": "module", "type": "module",
"scripts": {
"ci:publish": "bun publish --production --frozen-lockfile"
},
"devDependencies": { "devDependencies": {
"@types/bun": "latest" "@types/bun": "latest"
}, },
@ -9,4 +13,3 @@
"typescript": "^5.0.0" "typescript": "^5.0.0"
} }
} }

View file

@ -1,7 +1,11 @@
{ {
"name": "mini-strap-core", "name": "@mini-strap/core",
"version": "0.0.1",
"module": "src/style.scss", "module": "src/style.scss",
"type": "module", "type": "module",
"scripts": {
"ci:publish": "bun publish --production --frozen-lockfile --silent"
},
"devDependencies": { "devDependencies": {
"@types/bun": "latest" "@types/bun": "latest"
}, },
@ -9,4 +13,3 @@
"typescript": "^5.0.0" "typescript": "^5.0.0"
} }
} }

View file

@ -1,12 +1,13 @@
{ {
"name": "mini-strap-website", "name": "@mini-strap/website",
"private": true, "private": true,
"version": "0.0.0", "version": "0.0.1",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite --port 3000", "dev": "vite --port 3000",
"build": "tsc && vite build", "build": "tsc && vite build",
"preview": "vite preview" "preview": "vite preview",
"ci:publish": "echo 'no publish workflow defined to this package...'"
}, },
"devDependencies": { "devDependencies": {
"sass-embedded": "^1.78.0", "sass-embedded": "^1.78.0",