Skip to content

Commit 67e8b7c

Browse files
committed
chore(NODE-6160): sign and upload to releases
1 parent f7ae840 commit 67e8b7c

File tree

4 files changed

+121
-14
lines changed

4 files changed

+121
-14
lines changed

.github/actions/setup/action.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Setup
2+
description: 'Installs node, driver dependencies, and builds source'
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- uses: actions/setup-node@v4
8+
with:
9+
node-version: 'lts/*'
10+
cache: 'npm'
11+
registry-url: 'https://registry.npmjs.org'
12+
- run: npm install -g npm@latest
13+
shell: bash
14+
- run: npm clean-install --ignore-scripts
15+
shell: bash
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Sign and Upload Package
2+
description: 'Signs native modules with garasign'
3+
4+
inputs:
5+
aws_role_arn:
6+
description: 'AWS role input for drivers-github-tools/gpg-sign@v2'
7+
required: true
8+
aws_region_name:
9+
description: 'AWS region name input for drivers-github-tools/gpg-sign@v2'
10+
required: true
11+
aws_secret_id:
12+
description: 'AWS secret id input for drivers-github-tools/gpg-sign@v2'
13+
required: true
14+
npm_package_name:
15+
description: 'The name for the npm package this repository represents'
16+
required: true
17+
18+
runs:
19+
using: composite
20+
steps:
21+
- uses: actions/download-artifact@v4
22+
23+
- name: Make signatures directory
24+
shell: bash
25+
run: mkdir artifacts
26+
27+
- name: Set up drivers-github-tools
28+
uses: mongodb-labs/drivers-github-tools/setup@v2
29+
with:
30+
aws_region_name: ${{ inputs.aws_region_name }}
31+
aws_role_arn: ${{ inputs.aws_role_arn }}
32+
aws_secret_id: ${{ inputs.aws_secret_id }}
33+
34+
- name: Create detached signature
35+
uses: mongodb-labs/drivers-github-tools/gpg-sign@v2
36+
with:
37+
filenames: 'build-*/*.tar.gz'
38+
env:
39+
RELEASE_ASSETS: artifacts/
40+
41+
- name: Copy the tarballs to the artifacts directory
42+
shell: bash
43+
run: for filename in build-*/*.tar.gz; do cp ${filename} artifacts/; done
44+
45+
- name: Display structure of downloaded files
46+
shell: bash
47+
run: ls -la artifacts/
48+
49+
- name: Get release version and release package file name
50+
id: get_vars
51+
shell: bash
52+
run: |
53+
package_version=$(jq --raw-output '.version' package.json)
54+
echo "package_version=${package_version}" >> "$GITHUB_OUTPUT"
55+
56+
# - name: "Upload release artifacts"
57+
# run: gh release upload v${{ steps.get_vars.outputs.package_version }} artifacts/*.*
58+
# shell: bash
59+
# env:
60+
# GH_TOKEN: ${{ github.token }}

.github/workflows/build.yml

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ on:
55
branches: [main]
66
workflow_dispatch: {}
77

8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
id-token: write
12+
813
name: build
914

1015
jobs:
@@ -61,21 +66,32 @@ jobs:
6166
retention-days: 1
6267
compression-level: 0
6368

64-
collect:
69+
release_please:
6570
needs: [host_builds, container_builds]
6671
runs-on: ubuntu-latest
72+
outputs:
73+
release_created: ${{ steps.release.outputs.release_created }}
6774
steps:
68-
- uses: actions/download-artifact@v4
75+
- id: release
76+
uses: googleapis/release-please-action@v4
6977

70-
- name: Display structure of downloaded files
71-
run: ls -R
72-
73-
- id: upload
74-
name: Upload all prebuilds
75-
uses: actions/upload-artifact@v4
76-
with:
77-
name: all-build
78-
path: '*.tar.gz'
79-
if-no-files-found: 'error'
80-
retention-days: 1
81-
compression-level: 0
78+
sign_and_upload:
79+
needs: [host_builds, container_builds]
80+
# needs: [release_please]
81+
# if: ${{ needs.release_please.outputs.release_created }}
82+
runs-on: ubuntu-latest
83+
environment: release
84+
steps:
85+
- uses: actions/checkout@v4
86+
- name: actions/sign_and_upload_package
87+
uses: ./.github/actions/sign_and_upload_package
88+
with:
89+
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
90+
aws_region_name: 'us-east-1'
91+
aws_secret_id: ${{ secrets.AWS_SECRET_ID }}
92+
npm_package_name: 'mongodb-client-encryption'
93+
- name: actions/setup
94+
uses: ./.github/actions/setup
95+
# - run: npm publish --provenance
96+
# env:
97+
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

release-please-config.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"pull-request-title-pattern": "chore${scope}: release ${version} [skip-ci]",
4+
"pull-request-header": "Please run the release_notes action before releasing to generate release highlights",
5+
"packages": {
6+
".": {
7+
"include-component-in-tag": false,
8+
"changelog-path": "HISTORY.md",
9+
"release-type": "node",
10+
"bump-minor-pre-major": false,
11+
"bump-patch-for-minor-pre-major": false,
12+
"draft": false,
13+
"prerelease": false
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)