Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 13 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
# Bit Tag and Export for CI/CD Pipelines

Big Tag and Export to Remote Scope

# GitHub Actions

This task executes `bit ci merge` inside the workspace directory.

*Important*: `bit-tasks/tag-export@v3` requires Bit version `^1.12.45`, if you need to use a lower version, use `bit-tasks/tag-export@v2`.
_Important_: `bit-tasks/tag-export@v3|v4` requires Bit version `^1.12.45`, if you need to use a lower version, use `bit-tasks/tag-export@v2`.

## Inputs

### `ws-dir`

**Optional** The workspace directory path from the root. Default `"Dir specified in Init Task or ./"`.

### `persist`

**Optional** Persist soft tagged components by adding `--persist` flag.

### `build`

**Optional** Build the components before tagging.
Expand All @@ -28,6 +25,7 @@ This task executes `bit ci merge` inside the workspace directory.
### `increment`

**Optional** Type of increment for versioning. Available options:

- `major` - Major version increment
- `premajor` - Pre-major version increment
- `minor` - Minor version increment
Expand Down Expand Up @@ -61,17 +59,19 @@ The task detects version keywords in the following order:
You can specify version keywords using square brackets in either PR labels or PR title:

- `[major]` - Major version increment
- `[minor]` - Minor version increment
- `[minor]` - Minor version increment
- `[patch]` - Patch version increment (default)
- `[pre-release:<flag>]` - Pre-release version with custom identifier (e.g., `[pre-release:beta]`, `[pre-release:alpha]`)

### Examples

**Pull Request Labels:**

- Add a label named `[major]` to trigger a major version bump
- Add a label named `[pre-release:rc]` to create a release candidate

**Pull Request Title:**

- "Update component with breaking changes [major]"
- "Add new feature [minor]"
- "Fix bug [patch]"
Expand All @@ -80,24 +80,25 @@ You can specify version keywords using square brackets in either PR labels or PR
### Fallback Behavior

If no version keywords are detected in the last merged PR, the task will use the input parameters:

- `increment` parameter (e.g., `major`, `minor`, `patch`)
- `prerelease-id` parameter for pre-release versions

**Note:** The task processes the last merged pull request, not the current one. Make sure to add version keywords to the PR that will be merged before this task runs.

## Example usage

**Note:** Use `bit-task/init@v2` as a prior step in your action before running `bit-tasks/tag-export@v2`.
**Note:** Use `bit-task/init@v2` as a prior step in your action before running `bit-tasks/tag-export@v4`.

```yaml
name: Test Bit Tag and Export
on:
pull_request:
branches:
branches:
- main
types: [closed]
permissions:
pull-requests: write # Ensure write permission for pull requests
pull-requests: write # Ensure write permission for pull requests
jobs:
release:
runs-on: ubuntu-latest
Expand All @@ -113,11 +114,9 @@ jobs:
- name: Initialize Bit
uses: bit-tasks/init@v1
with:
ws-dir: '<WORKSPACE_DIR_PATH>'
ws-dir: "<WORKSPACE_DIR_PATH>"
- name: Bit Tag and Export
uses: bit-tasks/tag-export@v3
with:
persist: 'false' # Set to 'true' if you use the soft tag flow
uses: bit-tasks/tag-export@v4
```

# Contributor Guide
Expand All @@ -132,7 +131,7 @@ Go to the GithHub action task directory and build using NCC compiler. For exampl
npm install
npm run build
git commit -m "Update task"
git tag -a -m "action release" v2 --force
git tag -a -m "action release" v4 --force
git push --follow-tags
```

Expand Down
3 changes: 0 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ inputs:
ws-dir:
description: "Workspace json file directory path"
required: false
persist:
description: "Persist soft tagged components"
required: false
build:
description: "Build the components"
required: false
Expand Down
3 changes: 1 addition & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import run from "./scripts/tag-export";
try {
const githubToken = process.env.GITHUB_TOKEN;
const wsDir: string = core.getInput("ws-dir") || process.env.WSDIR || "./";
const persist: boolean = core.getInput("persist") === "true" ? true : false;
const build: boolean = core.getInput("build") === "true" ? true : false;
const increment: string = core.getInput("increment");
const prereleaseId: string = core.getInput("prerelease-id");
Expand All @@ -15,7 +14,7 @@ try {
throw new Error("GitHub token not found");
}

run(githubToken, wsDir, persist, build, increment, prereleaseId, incrementBy, strict);
run(githubToken, wsDir, build, increment, prereleaseId, incrementBy, strict);
} catch (error) {
core.setFailed((error as Error).message);
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bit-tasks/tag-export",
"version": "4.0.0",
"version": "4.0.1",
"description": "",
"main": "dist/index.js",
"scripts": {
Expand Down
6 changes: 1 addition & 5 deletions scripts/tag-export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function getOverridenVersions(labels?: any[]): string[] {
});
}

const run = async (githubToken: string, wsdir: string, persist: boolean, build: boolean, increment: string, prereleaseId: string, incrementBy: number, strict: boolean) => {
const run = async (githubToken: string, wsdir: string, build: boolean, increment: string, prereleaseId: string, incrementBy: number, strict: boolean) => {
const version = await getExecOutput("bit -v", [], { cwd: wsdir });

// If the version is lower than 1.12.45, throw an error recommending to downgrade the action version to v2
Expand Down Expand Up @@ -136,10 +136,6 @@ const run = async (githubToken: string, wsdir: string, persist: boolean, build:
}
}

if (persist) {
mergeArgs.push("--persist");
}

// Get overridden versions as an array
const overridenComponentVersions = getOverridenVersions(lastMergedPR?.labels);
core.info("Overriden labels: " + overridenComponentVersions.join(", "));
Expand Down
Loading