Skip to content

Commit d6bb4e4

Browse files
committed
Propose a Github Workflow for release process
1 parent fb96cc7 commit d6bb4e4

File tree

6 files changed

+81
-15
lines changed

6 files changed

+81
-15
lines changed

.github/workflows/publish.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [published, edited]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v3
13+
with:
14+
ref: ${{ github.event.release.tag_name }}
15+
- name: Use node.js 16.x
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: 16
19+
- name: NPM Install
20+
run: npm ci
21+
- name: Check Format
22+
run: npm run format:check
23+
- name: Lint
24+
run: npm run lint
25+
- name: Test
26+
run: npm run test
27+
- uses: JasonEtco/build-and-tag-action@v2
28+
env:
29+
GITHUB_TOKEN: ${{ github.token }}
30+
with:
31+
tag_name: ${{ github.event.release.tag_name }}

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,12 @@ For this reason, and to simplify what we expect to be the most common use-cases,
250250
we chose to start with the simplest possible configuration.
251251
If you find that these options don't meet your needs, please open an issue to let us know.
252252
253+
## Release Process
254+
255+
By creating a new Release a workflow is triggered creating a new commit which only contains `dist` and the `action.yml`. The necessary tags, i.e. for the release v1.0.7, the tag v1.0.7 is created and the v1.0 and v1 tags are updated.
256+
257+
For the tagging and building the [build-and-tag](https://github.com/JasonEtco/build-and-tag-action) action by [Jason Etcovitch](https://github.com/JasonEtco) is used. It expects to have the main attribute and a build script to be set in the `package.json`. It then builds the code with the ncc compiler and creates the new tag/ updates existing tags for minor and major versions automatically.
258+
253259
## License
254260
255261
This SDK is distributed under the

code-build.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,9 @@ function githubInputs() {
173173
core.getInput("compute-type-override", { required: false }) || undefined;
174174

175175
const environmentTypeOverride =
176-
core.getInput("environment-type-override", { required: false }) || undefined;
177-
const imageOverride =
176+
core.getInput("environment-type-override", { required: false }) ||
177+
undefined;
178+
const imageOverride =
178179
core.getInput("image-override", { required: false }) || undefined;
179180

180181
const envPassthrough = core

local.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,15 @@ const cb = require("./code-build");
88
const assert = require("assert");
99
const yargs = require("yargs");
1010

11-
const { projectName, buildspecOverride, computeTypeOverride, environmentTypeOverride, imageOverride, envPassthrough, remote } = yargs
11+
const {
12+
projectName,
13+
buildspecOverride,
14+
computeTypeOverride,
15+
environmentTypeOverride,
16+
imageOverride,
17+
envPassthrough,
18+
remote,
19+
} = yargs
1220
.option("project-name", {
1321
alias: "p",
1422
describe: "AWS CodeBuild Project Name",
@@ -22,17 +30,20 @@ const { projectName, buildspecOverride, computeTypeOverride, environmentTypeOver
2230
})
2331
.option("compute-type-override", {
2432
alias: "c",
25-
describe: "The name of a compute type for this build that overrides the one specified in the build project.",
33+
describe:
34+
"The name of a compute type for this build that overrides the one specified in the build project.",
2635
type: "string",
2736
})
2837
.option("environment-type-override", {
2938
alias: "et",
30-
describe: "A container type for this build that overrides the one specified in the build project.",
39+
describe:
40+
"A container type for this build that overrides the one specified in the build project.",
3141
type: "string",
3242
})
3343
.option("image-override", {
3444
alias: "i",
35-
describe: "The name of an image for this build that overrides the one specified in the build project.",
45+
describe:
46+
"The name of an image for this build that overrides the one specified in the build project.",
3647
type: "string",
3748
})
3849
.option("env-vars-for-codebuild", {

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
"name": "@aws-actions/codebuild-run-build",
33
"version": "1.0.4",
44
"description": "Execute CodeBuild::startBuild for the current repo.",
5-
"main": "index.js",
5+
"main": "dist/index.js",
66
"scripts": {
77
"lint": "prettier -c *.js *.json *.md test/*.js; eslint **.js test/**.js",
88
"format": "prettier --write -c *.js *.json *.md test/*.js; eslint --fix **.js test/**.js",
9+
"format:check": "prettier --check -c *.js *.json *.md test/*.js; eslint --fix **.js test/**.js",
910
"package": "ncc build index.js -o dist",
11+
"build": "ncc build index.js -o dist",
1012
"test": "mocha"
1113
},
1214
"author": "aws-crypto-tools-team@amazon.com",

test/code-build-test.js

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,12 @@ describe("githubInputs", () => {
7171
expect(test)
7272
.to.haveOwnProperty("buildspecOverride")
7373
.and.to.equal(undefined);
74-
expect(test).to.haveOwnProperty("computeTypeOverride").and.to.equal(undefined);
75-
expect(test).to.haveOwnProperty("environmentTypeOverride").and.to.equal(undefined);
74+
expect(test)
75+
.to.haveOwnProperty("computeTypeOverride")
76+
.and.to.equal(undefined);
77+
expect(test)
78+
.to.haveOwnProperty("environmentTypeOverride")
79+
.and.to.equal(undefined);
7680
expect(test).to.haveOwnProperty("imageOverride").and.to.equal(undefined);
7781
expect(test).to.haveOwnProperty("envPassthrough").and.to.deep.equal([]);
7882
});
@@ -123,8 +127,12 @@ describe("githubInputs", () => {
123127
expect(test)
124128
.to.haveOwnProperty("buildspecOverride")
125129
.and.to.equal(undefined);
126-
expect(test).to.haveOwnProperty("computeTypeOverride").and.to.equal(undefined);
127-
expect(test).to.haveOwnProperty("environmentTypeOverride").and.to.equal(undefined);
130+
expect(test)
131+
.to.haveOwnProperty("computeTypeOverride")
132+
.and.to.equal(undefined);
133+
expect(test)
134+
.to.haveOwnProperty("environmentTypeOverride")
135+
.and.to.equal(undefined);
128136
expect(test).to.haveOwnProperty("imageOverride").and.to.equal(undefined);
129137
expect(test).to.haveOwnProperty("envPassthrough").and.to.deep.equal([]);
130138
});
@@ -179,8 +187,12 @@ describe("inputs2Parameters", () => {
179187
expect(test)
180188
.to.haveOwnProperty("buildspecOverride")
181189
.and.to.equal(undefined);
182-
expect(test).to.haveOwnProperty("computeTypeOverride").and.to.equal(undefined);
183-
expect(test).to.haveOwnProperty("environmentTypeOverride").and.to.equal(undefined);
190+
expect(test)
191+
.to.haveOwnProperty("computeTypeOverride")
192+
.and.to.equal(undefined);
193+
expect(test)
194+
.to.haveOwnProperty("environmentTypeOverride")
195+
.and.to.equal(undefined);
184196
expect(test).to.haveOwnProperty("imageOverride").and.to.equal(undefined);
185197

186198
// I send everything that starts 'GITHUB_'
@@ -218,7 +230,8 @@ describe("inputs2Parameters", () => {
218230
repo: "repo",
219231
computeTypeOverride: "BUILD_GENERAL1_LARGE",
220232
environmentTypeOverride: "LINUX_CONTAINER",
221-
imageOverride: "111122223333.dkr.ecr.us-west-2.amazonaws.com/codebuild-docker-repo"
233+
imageOverride:
234+
"111122223333.dkr.ecr.us-west-2.amazonaws.com/codebuild-docker-repo",
222235
});
223236
expect(test).to.haveOwnProperty("projectName").and.to.equal(projectName);
224237
expect(test).to.haveOwnProperty("sourceVersion").and.to.equal(sha);
@@ -239,7 +252,9 @@ describe("inputs2Parameters", () => {
239252
.and.to.equal(`LINUX_CONTAINER`);
240253
expect(test)
241254
.to.haveOwnProperty("imageOverride")
242-
.and.to.equal(`111122223333.dkr.ecr.us-west-2.amazonaws.com/codebuild-docker-repo`);
255+
.and.to.equal(
256+
`111122223333.dkr.ecr.us-west-2.amazonaws.com/codebuild-docker-repo`
257+
);
243258

244259
// I send everything that starts 'GITHUB_'
245260
expect(test)

0 commit comments

Comments
 (0)