mirror of https://github.com/theNewDynamic/gohugo-theme-ananke.git

Patrick Kollitsch
4 hours ago 229588be6961d020af2f1e9557199bfb69a32ae7
build(fix): update release setup
1 files copied
2 files modified
1 files renamed
1 files added
122 ■■■■ changed files
.github/workflows/release.yml 47 ●●●●● patch | view | raw | blame | history
.release-it.prepare.ts 17 ●●●●● patch | view | raw | blame | history
.release-it.publish.ts 51 ●●●●● patch | view | raw | blame | history
.vscode/settings.json 2 ●●● patch | view | raw | blame | history
package.json 5 ●●●●● patch | view | raw | blame | history
.github/workflows/release.yml
New file
@@ -0,0 +1,47 @@
name: Release
on:
  workflow_dispatch:
permissions:
  contents: write
  id-token: write
concurrency:
  group: release-main
  cancel-in-progress: false
jobs:
  release:
    name: Release from main
    runs-on: ubuntu-latest
    environment:
      name: production
    if: github.ref == 'refs/heads/main'
    steps:
      - name: Checkout repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        with:
          fetch-depth: 0
          persist-credentials: true
      - name: Setup Node.js
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
        with:
          node-version: 22
          registry-url: "https://registry.npmjs.org"
      - name: Install dependencies
        run: npm ci
      - name: Run checks
        run: npm test
      - name: Release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
        run: npm run release
.release-it.prepare.ts
File was renamed from .release-it.ts
@@ -33,16 +33,16 @@
const branch = getCurrentBranch();
const isPreRelease = hasPreReleaseFlag(process.argv);
if (isPreRelease && branch !== "development") {
if (isPreRelease && branch !== "staging") {
    console.error(
        `Pre-releases are only allowed from "development". Current branch: "${branch}".`,
        `Pre-releases are only allowed from "staging". Current branch: "${branch}".`,
    );
    process.exit(1);
}
if (!isPreRelease && branch !== "main") {
if (!isPreRelease && branch !== "maintenance" && branch !== "staging") {
    console.error(
        `Stable releases are only allowed from "main". Current branch: "${branch}".`,
        `Stable releases are only allowed from "maintenance" and "staging". Current branch: "${branch}".`,
    );
    process.exit(1);
}
@@ -56,16 +56,11 @@
        commit: true,
        commitMessage: "chore(release): v${version}",
        commitArgs: ["--no-verify"],
        tag: true,
        tagName: "v${version}",
        tag: false,
        push: true,
        pushArgs: ["--follow-tags"],
    },
    github: {
        release: true,
        releaseName: "v${version}",
        skipChecks: true,
        tokenRef: "GITHUB_ANANKE_TOKEN_ADMIN_PRIVATE",
        release: false,
    },
    npm: {
        publish: false,
.release-it.publish.ts
copy from .release-it.ts copy to .release-it.publish.ts
File was copied from .release-it.ts
@@ -1,4 +1,3 @@
import { execSync } from "node:child_process";
import type { Config } from "release-it";
interface ConventionalCommitLike {
@@ -6,59 +5,15 @@
    notes?: unknown[];
}
function getCurrentBranch(): string {
    try {
        return execSync("git rev-parse --abbrev-ref HEAD", {
            encoding: "utf8",
            stdio: ["ignore", "pipe", "pipe"],
        }).trim();
    } catch (error) {
        console.error("Failed to determine the current Git branch.");
        console.error(error);
        process.exit(1);
    }
}
function hasPreReleaseFlag(argv: string[]): boolean {
    return argv.some((argument) => {
        return (
            argument === "--preRelease" ||
            argument.startsWith("--preRelease=") ||
            argument === "--preReleaseId" ||
            argument.startsWith("--preReleaseId=")
        );
    });
}
const branch = getCurrentBranch();
const isPreRelease = hasPreReleaseFlag(process.argv);
if (isPreRelease && branch !== "development") {
    console.error(
        `Pre-releases are only allowed from "development". Current branch: "${branch}".`,
    );
    process.exit(1);
}
if (!isPreRelease && branch !== "main") {
    console.error(
        `Stable releases are only allowed from "main". Current branch: "${branch}".`,
    );
    process.exit(1);
}
const config: Config = {
    git: {
        requireBranch: "main",
        requireCleanWorkingDir: true,
        requireUpstream: true,
        requireCommits: true,
        requireBranch: branch,
        commit: true,
        commitMessage: "chore(release): v${version}",
        commitArgs: ["--no-verify"],
        commit: false,
        tag: true,
        tagName: "v${version}",
        push: true,
        tagName: "v${version}",
        pushArgs: ["--follow-tags"],
    },
    github: {
.vscode/settings.json
@@ -23,7 +23,7 @@
    },
    "explorer.fileNesting.enabled": true,
    "explorer.fileNesting.patterns": {
        "package.json": "package-lock.json, netlify.toml, .lintstagedrc.js, .release-it.ts, .markdownlint*, .nvmrc, lychee.toml, tsconfig.json, .coderabbit.yaml",
        "package.json": "package-lock.json, netlify.toml, .lintstagedrc.js, .release-it.*.ts, .markdownlint*, .nvmrc, lychee.toml, tsconfig.json, .coderabbit.yaml",
        "theme.toml": "go.mod, go.sum",
        "README.md": "CHANGELOG.md, LICENSE.md, CONTRIBUTING.md, RELEASES.md, DESIGN.md"
    },
package.json
@@ -56,8 +56,9 @@
        "lint:markdown": "markdownlint-cli2",
        "lint:markdown:fix": "markdownlint-cli2 --fix",
        "prepare": "simple-git-hooks install",
        "release": "release-it --config .release-it.ts",
        "release:pre": "release-it --preRelease=prerelease --config .release-it.ts",
        "release:pre": "release-it --preRelease=prerelease --config .release-it.publish.ts --ci",
        "release:prepare": "release-it --config .release-it.prepare.ts",
        "release": "release-it --config .release-it.publish.ts --ci",
        "server": "hugo server --environment documentation",
        "test": "node scripts/test-hugo-quickstart.ts",
        "test:quickstart": "node scripts/test-hugo-quickstart.ts",