-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.ts
More file actions
27 lines (22 loc) · 908 Bytes
/
main.ts
File metadata and controls
27 lines (22 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import * as core from '@actions/core';
import { Artifacts } from '@model/artifacts';
import { Tags } from '@model/tags';
import { TemporaryBranch } from '@model/temporary-branch';
import { createGit } from './create-git';
import { Configuration } from './configuration';
async function main(): Promise<void> {
const configuration = new Configuration(core.getInput.bind(core), process.env);
const git = await createGit();
const tags = new Tags(git);
const artifacts = new Artifacts(git, tags, configuration);
const temporaryBranch = new TemporaryBranch(git);
const { isTag } = configuration;
Promise.resolve()
.then(() => (isTag ? temporaryBranch.create() : null))
.then(() => artifacts.update())
.then(() => (isTag ? temporaryBranch.delete() : null))
.catch((error) => {
core.setFailed(`Failed to create and push artifacts: ${error}`);
});
}
export default main;