Skip to content

Commit

Permalink
ci: filter release commit only for bump check
Browse files Browse the repository at this point in the history
  • Loading branch information
Wroud committed Sep 9, 2024
1 parent bdabf2e commit cef7894
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ jobs:
- name: Run ci:prepublish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
GITHUB_REPOSITORY_NAME: ${{ github.repository }}
GITHUB_REPOSITORY: ${{ github.repository }}
run: yarn workspaces foreach -A --no-private run ci:prepublish

- name: Release
Expand Down
9 changes: 5 additions & 4 deletions packages/ci/src/gulp/prepublish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,22 @@ import { pipeline } from "stream/promises";
import { combineStreams } from "./combineStreams.js";
import { createReadStream, createWriteStream, existsSync } from "fs";
import { githubRelease } from "@wroud/ci-github-release";
import { releaseCommitRegex } from "./releaseCommitRegex.js";

const tagPrefix = "di-v";
const commitPath = ".";
const changeLogFile = "CHANGELOG.md";
// print output of commands into the terminal
const stdio = "inherit";
const commitsConfig = { path: commitPath, ignore: /^chore: release/ };
const commitsConfig = { path: commitPath /*, ignore: releaseCommitRegex*/ };

async function bumpVersion(preset: Preset): Promise<string | null> {
const bumper = new RestrictEmptyCommits(process.cwd())
.loadPreset(preset)
.tag({
prefix: tagPrefix,
})
.commits(commitsConfig);
.commits({ ...commitsConfig, ignore: releaseCommitRegex });

const recommendation = await bumper.bump();

Expand Down Expand Up @@ -81,8 +82,8 @@ async function commitTagPush(version: string) {

async function publishGithubRelease(preset: Preset) {
const token = process.env["GITHUB_TOKEN"];
const owner = process.env["GITHUB_REPOSITORY_OWNER"];
const repository = process.env["GITHUB_REPOSITORY_NAME"];
const [owner, repository] =
process.env["GITHUB_REPOSITORY"]?.split("/") || [];

if (!token) {
throw new Error("Expected GITHUB_TOKEN environment variable");
Expand Down
1 change: 1 addition & 0 deletions packages/ci/src/gulp/releaseCommitRegex.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const releaseCommitRegex = /^chore: release/;
2 changes: 1 addition & 1 deletion packages/di/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![ESM-only package][package]][package-url]
[![NPM version][npm]][npm-url]

<!-- [![Install size][size]][size-url] -->
<!-- [![Install size][size]][size-url] test -->

[package]: https://img.shields.io/badge/package-ESM--only-ffe536.svg
[package-url]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
Expand Down

0 comments on commit cef7894

Please sign in to comment.