diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml new file mode 100644 index 0000000..5fc67f0 --- /dev/null +++ b/.forgejo/workflows/publish.yaml @@ -0,0 +1,46 @@ +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: Create release + uses: oknozor/cocogitto-action@v3 + with: + release: false + git-user: 'Cog Bot' + git-user-email: 'cog@alecodes.page' + env: + NPM_REGISTRY_TOKEN: ${{ secrets.NPM_TOKEN_FORGEJO }} + run: "cog bump --auto --hook-profile ${{ env.NPM_TAG }}" + + - name: Summary + run: | + echo "Bun executable chache found:\t${{ steps.setup_bun.outputs.cache-hit }}"; + echo "Bun dependencies chache found:\t${{ steps.cache.outputs.cache-hit }}"; + echo "Package published:\t${{ steps.publish.outcome }}"; diff --git a/bun.lockb b/bun.lockb index 74b89ee..9e0278b 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/bunfig.toml b/bunfig.toml new file mode 100644 index 0000000..63cb7c5 --- /dev/null +++ b/bunfig.toml @@ -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/" } diff --git a/cog.toml b/cog.toml new file mode 100644 index 0000000..8303a52 --- /dev/null +++ b/cog.toml @@ -0,0 +1,39 @@ +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", +] +post_package_bump_hooks = [] + +[git_hooks] + +[commit_types] + +[changelog] +path = "CHANGELOG.md" +authors = [] + +[bump_profiles.latest] +pre_package_bump_hooks = [ + "bun run ci:publish --tag latest", +] + +[bump_profiles.next] +pre_package_bump_hooks = [ + "bun run ci:publish --tag next", +] + +[packages] +"@mini-strap/core" = { path = "packages/core" } +"@mini-strap/components" = { path = "packages/components" } +"@mini-strap/website" = { path = "packages/website", public_api = false } diff --git a/package.json b/package.json index 5b82e52..cd42aea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,8 @@ { - "name": "mini-strap", + "name": "@alecodes/mini-strap", + "version": "0.0.1", "module": "index.ts", + "private": true, "devDependencies": { "@eslint/js": "^9.10.0", "@types/bun": "latest", @@ -14,8 +16,12 @@ "typescript": "^5.0.0" }, "scripts": { - "dev": "bun --filter '*' dev" + "dev": "bun --filter '*' dev", + "ci:publish": "bun --filter '**/core' ci:publish", + "bump": "cog bump --auto --skip-untracked" }, "type": "module", - "workspaces": ["packages/*"] + "workspaces": [ + "packages/*" + ] } diff --git a/packages/components/package.json b/packages/components/package.json index 5dcfbc8..35b8200 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,7 +1,11 @@ { - "name": "mini-strap-components", + "name": "@mini-strap/components", + "version": "0.0.1", "module": "src/components.scss", "type": "module", + "scripts": { + "ci:publish": "bun publish --production --frozen-lockfile" + }, "devDependencies": { "@types/bun": "latest" }, @@ -9,4 +13,3 @@ "typescript": "^5.0.0" } } - diff --git a/packages/core/package.json b/packages/core/package.json index dce323a..379bddc 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,7 +1,11 @@ { - "name": "mini-strap-core", + "name": "@mini-strap/core", + "version": "0.0.1", "module": "src/style.scss", "type": "module", + "scripts": { + "ci:publish": "bun publish --production --frozen-lockfile --silent" + }, "devDependencies": { "@types/bun": "latest" }, @@ -9,4 +13,3 @@ "typescript": "^5.0.0" } } - diff --git a/packages/website/package.json b/packages/website/package.json index 2114401..1facccc 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -1,12 +1,13 @@ { - "name": "mini-strap-website", + "name": "@mini-strap/website", "private": true, - "version": "0.0.0", + "version": "0.0.1", "type": "module", "scripts": { "dev": "vite --port 3000", "build": "tsc && vite build", - "preview": "vite preview" + "preview": "vite preview", + "ci:publish": "echo 'no publish workflow defined to this package...'" }, "devDependencies": { "sass-embedded": "^1.78.0",