Compare commits

...

26 Commits
v6.0 ... master

Author SHA1 Message Date
dependabot[bot] 9d35d648e8
Bump ws from 7.5.5 to 7.5.10 (#216)
Bumps [ws](https://github.com/websockets/ws) from 7.5.5 to 7.5.10.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.5.5...7.5.10)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-18 09:28:43 +02:00
dependabot[bot] 17d01dc92c
Bump braces from 3.0.2 to 3.0.3 (#215)
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-18 09:28:29 +02:00
mathieudutour f36074fe49
version 6.2 2024-03-11 10:22:39 +01:00
Essau Ramirez f40d7eefd8
match latest tag regex (#171)
* match latest tag regex

* Lint fixes
2024-03-11 09:58:22 +01:00
Yoshikawa Teru 1bf7977a3d
fix: add previous_version to action.yml (#183) 2024-03-11 09:53:34 +01:00
dependabot[bot] 5a16d14432
Bump tough-cookie from 4.0.0 to 4.1.3 (#184)
Bumps [tough-cookie](https://github.com/salesforce/tough-cookie) from 4.0.0 to 4.1.3.
- [Release notes](https://github.com/salesforce/tough-cookie/releases)
- [Changelog](https://github.com/salesforce/tough-cookie/blob/master/CHANGELOG.md)
- [Commits](https://github.com/salesforce/tough-cookie/compare/v4.0.0...v4.1.3)

---
updated-dependencies:
- dependency-name: tough-cookie
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-11 09:52:34 +01:00
Filipe Veloso 71c3689659
Update README.md (#205)
update gh action checkout  version in example
2024-03-11 09:52:15 +01:00
naresh-gn a079ba461d
Update Node version to 20 (#202)
* Update Node version to 20

* Update Node version to 20

* Update Node version to 20

* Update .github/workflows/test.yml

Co-authored-by: cawfeecake <48775802+cawfeecake@users.noreply.github.com>

---------

Co-authored-by: Naresh Nagarajan <naresh-gn@gmail.com>
Co-authored-by: cawfeecake <48775802+cawfeecake@users.noreply.github.com>
2024-03-11 09:51:45 +01:00
Mathieu Dutour 86301c823d
Revert "Use `${{github.token}}` as default" (#167) 2023-02-06 13:16:45 +01:00
dependabot[bot] 5bd9038fd1
Bump minimatch from 3.0.4 to 3.1.2 (#162)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-22 17:27:02 +01:00
Chris Hilton ac8cb38838
getValidTags() should exclude tags that do not match the prefixRegex (#158) 2023-01-22 17:26:50 +01:00
dependabot[bot] 664437484d
Bump json5 from 2.1.3 to 2.2.3 (#161)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-22 17:25:57 +01:00
kzrnm 87d9c10c43
Use `${{github.token}}` as default (#154)
Co-authored-by: Mathieu Dutour <mathieu@dutour.me>
2023-01-22 17:25:46 +01:00
mathieudutour dbd80d2e9d
version 6.1 2022-10-26 11:00:15 +02:00
James Phillips a1afa112d3
Correctly parse `create_annotated_tag` (#137) 2022-10-26 10:57:31 +02:00
Mathieu Dutour 3f9dffdaa0
Merge pull request #147 from JohnTitor/nodejs16 2022-10-26 10:52:06 +02:00
Mathieu Dutour c4f56e7003
Merge pull request #146 from JohnTitor/actions-core 2022-10-26 10:51:42 +02:00
Yuki Okushi 923acce875
Update `@actions/core` to v1.10.0
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-10-14 11:46:39 +09:00
Yuki Okushi c5ababce46
Update to Node.js 16
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-10-14 11:44:46 +09:00
Mathieu Dutour e923a6115f
Merge pull request #142 from mathieudutour/dependabot/npm_and_yarn/actions/core-1.9.1 2022-08-19 08:49:47 +02:00
dependabot[bot] 8bee2b2289
Bump @actions/core from 1.6.0 to 1.9.1
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.6.0 to 1.9.1.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-18 19:17:35 +00:00
Mathieu Dutour 92dc56ebab
Merge pull request #124 from mathieudutour/dependabot/npm_and_yarn/node-fetch-2.6.7
Bump node-fetch from 2.6.1 to 2.6.7
2022-04-12 13:58:28 +02:00
dependabot[bot] 15886d3d8c
Bump node-fetch from 2.6.1 to 2.6.7
Bumps [node-fetch](https://github.com/node-fetch/node-fetch) from 2.6.1 to 2.6.7.
- [Release notes](https://github.com/node-fetch/node-fetch/releases)
- [Commits](https://github.com/node-fetch/node-fetch/compare/v2.6.1...v2.6.7)

---
updated-dependencies:
- dependency-name: node-fetch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-12 09:50:07 +00:00
Mathieu Dutour f1a52e6b0e
Merge pull request #123 from mathieudutour/dependabot/npm_and_yarn/minimist-1.2.6
Bump minimist from 1.2.5 to 1.2.6
2022-04-12 11:49:30 +02:00
dependabot[bot] 672968b48d
Bump minimist from 1.2.5 to 1.2.6
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-11 19:34:53 +00:00
Mathieu Dutour ba54fd76a5
Create FUNDING.yml 2021-11-17 12:21:25 +01:00
9 changed files with 624 additions and 1117 deletions

1
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1 @@
github: [mathieudutour]

View File

@ -9,7 +9,10 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: package.json
- run: npm ci
- run: npm run test
- run: npm run check

View File

@ -14,10 +14,10 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.0
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create a GitHub release

View File

@ -8,6 +8,8 @@ outputs:
description: "Generated tag without the prefix"
previous_tag:
description: "Previous tag (or `0.0.0`)"
previous_version:
description: "The value of the previous tag (or 0.0.0 if none) without the prefix. Note that if custom_tag is set, this will be undefined."
release_type:
description: "The computed release type (`major`, `minor`, `patch` or `custom` - can be prefixed with `pre`)"
changelog:
@ -61,7 +63,7 @@ inputs:
default: "false"
runs:
using: "node12"
using: "node20"
main: "lib/main.js"
branding:
icon: "git-merge"

1640
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "github-tag-action",
"version": "6.0.0",
"version": "6.2.0",
"private": true,
"description": "A GitHub Action to automatically bump and tag master, on merge, with the latest SemVer formatted version.",
"main": "lib/main.js",
@ -18,10 +18,13 @@
"node",
"setup"
],
"engines": {
"node": ">=20"
},
"author": "Mathieu Dutour",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.6.0",
"@actions/core": "^1.10.0",
"@actions/exec": "^1.1.0",
"@actions/github": "^4.0.0",
"@semantic-release/commit-analyzer": "^8.0.1",
@ -33,7 +36,7 @@
"@octokit/rest": "^18.12.0",
"@types/jest": "^27.0.2",
"@types/js-yaml": "^4.0.4",
"@types/node": "^16.11.7",
"@types/node": "^20.11.16",
"@types/semver": "^7.3.9",
"jest": "^27.3.1",
"jest-circus": "^27.3.1",

View File

@ -25,7 +25,9 @@ export default async function main() {
const releaseBranches = core.getInput('release_branches');
const preReleaseBranches = core.getInput('pre_release_branches');
const appendToPreReleaseTag = core.getInput('append_to_pre_release_tag');
const createAnnotatedTag = !!core.getInput('create_annotated_tag');
const createAnnotatedTag = /true/i.test(
core.getInput('create_annotated_tag')
);
const dryRun = core.getInput('dry_run');
const customReleaseRules = core.getInput('custom_release_rules');
const shouldFetchAllTags = core.getInput('fetch_all_tags');

View File

@ -15,13 +15,17 @@ export async function getValidTags(
const tags = await listTags(shouldFetchAllTags);
const invalidTags = tags.filter(
(tag) => !valid(tag.name.replace(prefixRegex, ''))
(tag) =>
!prefixRegex.test(tag.name) || !valid(tag.name.replace(prefixRegex, ''))
);
invalidTags.forEach((name) => core.debug(`Found Invalid Tag: ${name}.`));
const validTags = tags
.filter((tag) => valid(tag.name.replace(prefixRegex, '')))
.filter(
(tag) =>
prefixRegex.test(tag.name) && valid(tag.name.replace(prefixRegex, ''))
)
.sort((a, b) =>
rcompare(a.name.replace(prefixRegex, ''), b.name.replace(prefixRegex, ''))
);
@ -59,7 +63,11 @@ export function getLatestTag(
tagPrefix: string
) {
return (
tags.find((tag) => !prerelease(tag.name.replace(prefixRegex, ''))) || {
tags.find(
(tag) =>
prefixRegex.test(tag.name) &&
!prerelease(tag.name.replace(prefixRegex, ''))
) || {
name: `${tagPrefix}0.0.0`,
commit: {
sha: 'HEAD',

View File

@ -57,7 +57,7 @@ describe('utils', () => {
node_id: 'string',
},
{
name: '1.2.3',
name: 'v1.2.3',
commit: { sha: 'string', url: 'string' },
zipball_url: 'string',
tarball_url: 'string',
@ -86,28 +86,28 @@ describe('utils', () => {
*/
const testTags = [
{
name: '1.2.4-prerelease.1',
name: 'v1.2.4-prerelease.1',
commit: { sha: 'string', url: 'string' },
zipball_url: 'string',
tarball_url: 'string',
node_id: 'string',
},
{
name: '1.2.4-prerelease.2',
name: 'v1.2.4-prerelease.2',
commit: { sha: 'string', url: 'string' },
zipball_url: 'string',
tarball_url: 'string',
node_id: 'string',
},
{
name: '1.2.4-prerelease.0',
name: 'v1.2.4-prerelease.0',
commit: { sha: 'string', url: 'string' },
zipball_url: 'string',
tarball_url: 'string',
node_id: 'string',
},
{
name: '1.2.3',
name: 'v1.2.3',
commit: { sha: 'string', url: 'string' },
zipball_url: 'string',
tarball_url: 'string',
@ -128,7 +128,55 @@ describe('utils', () => {
*/
expect(mockListTags).toHaveBeenCalled();
expect(validTags[0]).toEqual({
name: '1.2.4-prerelease.2',
name: 'v1.2.4-prerelease.2',
commit: { sha: 'string', url: 'string' },
zipball_url: 'string',
tarball_url: 'string',
node_id: 'string',
});
});
it('returns only prefixed tags', async () => {
/*
* Given
*/
const testTags = [
{
name: 'app2/5.0.0',
commit: { sha: 'string', url: 'string' },
zipball_url: 'string',
tarball_url: 'string',
node_id: 'string',
},
{
name: '7.0.0',
commit: { sha: 'string', url: 'string' },
zipball_url: 'string',
tarball_url: 'string',
node_id: 'string',
},
{
name: 'app1/3.0.0',
commit: { sha: 'string', url: 'string' },
zipball_url: 'string',
tarball_url: 'string',
node_id: 'string',
},
];
const mockListTags = jest
.spyOn(github, 'listTags')
.mockImplementation(async () => testTags);
/*
* When
*/
const validTags = await getValidTags(/^app1\//, false);
/*
* Then
*/
expect(mockListTags).toHaveBeenCalled();
expect(validTags).toHaveLength(1);
expect(validTags[0]).toEqual({
name: 'app1/3.0.0',
commit: { sha: 'string', url: 'string' },
zipball_url: 'string',
tarball_url: 'string',