@@ -2,7 +2,7 @@ name: Build and Release
2
2
3
3
on :
4
4
push :
5
- branches : [ main ]
5
+ branches : [ main, fabisev/artifact-publishing ]
6
6
tags : [ 'v*', 'rc-*' ]
7
7
pull_request :
8
8
branches : [ main ]
31
31
id : version
32
32
run : |
33
33
BASE_VERSION=$(node -p "require('./package.json').version")
34
- echo "version=$BASE_VERSION" >> $GITHUB_OUTPUT
34
+ if [[ "${{ github.ref }}" == "refs/heads/fabisev/artifact-publishing" ]]; then
35
+ TEST_VERSION="${BASE_VERSION}-test.${GITHUB_SHA:0:7}"
36
+ npm version $TEST_VERSION --no-git-tag-version
37
+ echo "version=$TEST_VERSION" >> $GITHUB_OUTPUT
38
+ else
39
+ echo "version=$BASE_VERSION" >> $GITHUB_OUTPUT
40
+ fi
35
41
36
42
- name : Install build dependencies
37
43
run : |
47
53
48
54
- name : Generate checksums
49
55
run : |
50
- PACKAGE_FILE=$(ls aws-lambda-ric -*.tgz)
56
+ PACKAGE_FILE=$(ls icecream-shop -*.tgz)
51
57
sha256sum $PACKAGE_FILE > checksums.sha256
52
58
sha512sum $PACKAGE_FILE > checksums.sha512
53
59
cat checksums.sha256 checksums.sha512 > checksums.txt
58
64
with :
59
65
name : package-${{ steps.version.outputs.version }}
60
66
path : |
61
- aws-lambda-ric -*.tgz
67
+ icecream-shop -*.tgz
62
68
checksums.*
63
69
retention-days : 30
64
70
77
83
docker run --rm unit/nodejs.${{ matrix.node-version }}x
78
84
79
85
publish :
80
- if : startsWith(github.ref, 'refs/tags/')
86
+ if : startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/fabisev/artifact-publishing'
81
87
runs-on : codebuild-project-awsaws-lambda-nodejs-runtime-interface-client-${{ github.run_id }}-${{ github.run_attempt }}
82
88
needs : [build, test]
83
89
permissions :
@@ -98,37 +104,42 @@ jobs:
98
104
- name : Setup NPM authentication
99
105
run : |
100
106
NPM_TOKEN=$(aws secretsmanager get-secret-value --secret-id aws-lambda-runtimes/github/nodejs/npm-token --query SecretString --output text)
101
- echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
107
+ echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
108
+ chmod 0600 .npmrc
102
109
103
110
- name : Determine version and package name
104
111
id : version
105
112
run : |
106
- if [[ "${{ github.ref }}" == refs/tags/rc-* ]]; then
113
+ if [[ "${{ github.ref }}" == "refs/heads/fabisev/artifact-publishing" ]]; then
114
+ TEST_VERSION="${{ needs.build.outputs.version }}-test.${GITHUB_SHA:0:7}"
115
+ echo "package_version=$TEST_VERSION" >> $GITHUB_OUTPUT
116
+ echo "is_test=true" >> $GITHUB_OUTPUT
117
+ elif [[ "${{ github.ref }}" == refs/tags/rc-* ]]; then
107
118
RC_NUMBER=${GITHUB_REF#refs/tags/rc-}
108
119
PACKAGE_VERSION="${{ needs.build.outputs.version }}-rc.${RC_NUMBER}"
109
120
echo "package_version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
110
121
echo "is_rc=true" >> $GITHUB_OUTPUT
111
- npm version $PACKAGE_VERSION --no-git-tag-version
112
122
else
113
123
echo "package_version=${{ needs.build.outputs.version }}" >> $GITHUB_OUTPUT
114
- npm version ${{ needs.build.outputs.version }} --no-git-tag-version
115
124
fi
116
- npm pack
117
125
118
126
- name : Publish to npm
119
127
run : |
120
- if [[ "${{ steps.version.outputs.is_rc }}" == "true" ]]; then
121
- npm publish aws-lambda-ric-*.tgz --tag rc
128
+ PACKAGE_FILE=$(ls icecream-shop-*.tgz)
129
+ if [[ "${{ steps.version.outputs.is_test }}" == "true" ]]; then
130
+ npm publish $PACKAGE_FILE --tag test --access=public
131
+ elif [[ "${{ steps.version.outputs.is_rc }}" == "true" ]]; then
132
+ npm publish $PACKAGE_FILE --tag rc --access=public
122
133
else
123
- npm publish aws-lambda-ric-*.tgz
134
+ npm publish $PACKAGE_FILE --access=public
124
135
fi
125
136
126
137
- name : Create GitHub Release
127
138
if : startsWith(github.ref, 'refs/tags/')
128
139
uses : softprops/action-gh-release@v2
129
140
with :
130
141
files : |
131
- aws-lambda-ric -*.tgz
142
+ icecream-shop -*.tgz
132
143
checksums.sha256
133
144
checksums.sha512
134
145
checksums.txt
0 commit comments