Skip to content

Commit

Permalink
Merge branch 'master' into v2
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreeman committed Nov 30, 2022
2 parents 59d8d98 + 624bb84 commit 25240b5
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 25 deletions.
55 changes: 35 additions & 20 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,20 @@ import { initRepository, addAndTrackRemote } from './helpers/git';

runTestsInScratchDirectory();

let originalOutput = process.env.GITHUB_OUTPUT;

beforeEach(async () => {
await initRepository(process.cwd());

fs.writeFileSync('package.json', JSON.stringify({ version: '1.2.3' }));
await execa('git', ['add', 'package.json']);
await execa('git', ['commit', '-m', 'Add package.json']);

delete process.env.GITHUB_OUTPUT;
});

afterEach(() => {
process.env.GITHUB_OUTPUT = originalOutput;
});

describe('with a changed version', () => {
Expand All @@ -33,14 +41,17 @@ describe('with a changed version', () => {
await execa('git', ['rev-parse', 'v2.0.0']);
await execa('git', ['rev-parse', 'v2.0.0'], { cwd: 'upstream' });

expect(result.stdout.trim().split('\n')).toEqual([
'Previous version: 1.2.3',
'::set-output name=previous-version::1.2.3',
'Current version: 2.0.0',
'::set-output name=current-version::2.0.0',
'Creating tag v2.0.0',
'::set-output name=tag::v2.0.0',
]);
expect(result.stdout).toMatchInlineSnapshot(`
"Previous version: 1.2.3
::set-output name=previous-version::1.2.3
Current version: 2.0.0
::set-output name=current-version::2.0.0
Creating tag v2.0.0
::set-output name=tag::v2.0.0"
`);
});

test('skips tag creation when configured to', async () => {
Expand All @@ -51,12 +62,14 @@ describe('with a changed version', () => {
},
});

expect(result.stdout.trim().split('\n')).toEqual([
'Previous version: 1.2.3',
'::set-output name=previous-version::1.2.3',
'Current version: 2.0.0',
'::set-output name=current-version::2.0.0',
]);
expect(result.stdout).toMatchInlineSnapshot(`
"Previous version: 1.2.3
::set-output name=previous-version::1.2.3
Current version: 2.0.0
::set-output name=current-version::2.0.0"
`);
});
});

Expand All @@ -71,11 +84,13 @@ describe('with no version change', () => {
},
});

expect(result.stdout.trim().split('\n')).toEqual([
'Previous version: 1.2.3',
'::set-output name=previous-version::1.2.3',
'Current version: 1.2.3',
'::set-output name=current-version::1.2.3',
]);
expect(result.stdout).toMatchInlineSnapshot(`
"Previous version: 1.2.3
::set-output name=previous-version::1.2.3
Current version: 1.2.3
::set-output name=current-version::1.2.3"
`);
});
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"author": "Dan Freeman",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.2.0",
"@actions/core": "^1.10.0",
"execa": "^4.0.0",
"glob": "^7.1.6"
},
Expand Down
28 changes: 24 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@
# yarn lockfile v1


"@actions/core@^1.2.0":
version "1.2.2"
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.2.tgz#3c4848d50378f9e3bcb67bcf97813382ec7369ee"
integrity sha512-IbCx7oefq+Gi6FWbSs2Fnw8VkEI6Y4gvjrYprY3RV//ksq/KPMlClOerJ4jRosyal6zkUIc8R9fS/cpRMlGClg==
"@actions/core@^1.10.0":
version "1.10.0"
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.10.0.tgz#44551c3c71163949a2f06e94d9ca2157a0cfac4f"
integrity sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==
dependencies:
"@actions/http-client" "^2.0.1"
uuid "^8.3.2"

"@actions/http-client@^2.0.1":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@actions/http-client/-/http-client-2.0.1.tgz#873f4ca98fe32f6839462a6f046332677322f99c"
integrity sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==
dependencies:
tunnel "^0.0.6"

"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.8.3":
version "7.8.3"
Expand Down Expand Up @@ -3703,6 +3713,11 @@ tunnel-agent@^0.6.0:
dependencies:
safe-buffer "^5.0.1"

tunnel@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/tunnel/-/tunnel-0.0.6.tgz#72f1314b34a5b192db012324df2cc587ca47f92c"
integrity sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==

tweetnacl@^0.14.3, tweetnacl@~0.14.0:
version "0.14.5"
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64"
Expand Down Expand Up @@ -3775,6 +3790,11 @@ uuid@^3.3.2:
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==

uuid@^8.3.2:
version "8.3.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==

v8-compile-cache@^2.0.3:
version "2.1.0"
resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz#e14de37b31a6d194f5690d67efc4e7f6fc6ab30e"
Expand Down

0 comments on commit 25240b5

Please sign in to comment.