@@ -2,7 +2,7 @@ name: Build and Release
22
33on :
44 push :
5- branches : [ main ]
5+ branches : [ main, fabisev/artifact-publishing ]
66 tags : [ 'v*', 'rc-*' ]
77 pull_request :
88 branches : [ main ]
3131 id : version
3232 run : |
3333 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
3541
3642 - name : Install build dependencies
3743 run : |
4753
4854 - name : Generate checksums
4955 run : |
50- PACKAGE_FILE=$(ls aws-lambda-ric -*.tgz)
56+ PACKAGE_FILE=$(ls icecream-shop -*.tgz)
5157 sha256sum $PACKAGE_FILE > checksums.sha256
5258 sha512sum $PACKAGE_FILE > checksums.sha512
5359 cat checksums.sha256 checksums.sha512 > checksums.txt
5864 with :
5965 name : package-${{ steps.version.outputs.version }}
6066 path : |
61- aws-lambda-ric -*.tgz
67+ icecream-shop -*.tgz
6268 checksums.*
6369 retention-days : 30
6470
7783 docker run --rm unit/nodejs.${{ matrix.node-version }}x
7884
7985 publish :
80- if : startsWith(github.ref, 'refs/tags/')
86+ if : startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/fabisev/artifact-publishing'
8187 runs-on : codebuild-project-awsaws-lambda-nodejs-runtime-interface-client-${{ github.run_id }}-${{ github.run_attempt }}
8288 needs : [build, test]
8389 permissions :
@@ -98,37 +104,42 @@ jobs:
98104 - name : Setup NPM authentication
99105 run : |
100106 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
102109
103110 - name : Determine version and package name
104111 id : version
105112 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
107118 RC_NUMBER=${GITHUB_REF#refs/tags/rc-}
108119 PACKAGE_VERSION="${{ needs.build.outputs.version }}-rc.${RC_NUMBER}"
109120 echo "package_version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
110121 echo "is_rc=true" >> $GITHUB_OUTPUT
111- npm version $PACKAGE_VERSION --no-git-tag-version
112122 else
113123 echo "package_version=${{ needs.build.outputs.version }}" >> $GITHUB_OUTPUT
114- npm version ${{ needs.build.outputs.version }} --no-git-tag-version
115124 fi
116- npm pack
117125
118126 - name : Publish to npm
119127 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
122133 else
123- npm publish aws-lambda-ric-*.tgz
134+ npm publish $PACKAGE_FILE --access=public
124135 fi
125136
126137 - name : Create GitHub Release
127138 if : startsWith(github.ref, 'refs/tags/')
128139 uses : softprops/action-gh-release@v2
129140 with :
130141 files : |
131- aws-lambda-ric -*.tgz
142+ icecream-shop -*.tgz
132143 checksums.sha256
133144 checksums.sha512
134145 checksums.txt
0 commit comments