-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
140 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env node | ||
|
||
const { context, getOctokit } = require('@actions/github'); | ||
const { setOutput } = require('@actions/core'); | ||
|
||
const semver = require('semver'); | ||
|
||
console.assert(process.env.GITHUB_TOKEN, "GITHUB_TOKEN not present"); | ||
|
||
const octokit = getOctokit(process.env.GITHUB_TOKEN); | ||
const workspace = process.env.GITHUB_WORKSPACE; | ||
|
||
main(); | ||
|
||
async function validateReleaseVersion() { | ||
const { | ||
repo: { owner, repo }, | ||
payload: { number }, | ||
} = context; | ||
console.assert(number, "number not present"); | ||
|
||
const { version } = require(`${workspace}/package.json`); | ||
console.log("Submitted Version: ", version) | ||
|
||
const { data: latest } = await octokit.request(`GET /repos/${owner}/${repo}/releases/latest`, { | ||
headers: { | ||
'X-GitHub-Api-Version': '2022-11-28' | ||
} | ||
}) | ||
console.log("Latest Version: ", latest.name) | ||
|
||
// Version set in package.json must be greater than latest | ||
if (! semver.gt(version, latest.name)) { | ||
console.log("version property in package.json must be greater than: ", latest.name) | ||
process.exit(1); | ||
} | ||
return version; | ||
} | ||
|
||
async function main() { | ||
const version = await validateReleaseVersion(); | ||
setOutput("version", version); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: New Pull request; publish as beta package | ||
|
||
on: | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
env: | ||
NPM_REGISTRY_URL: "https://registry.npmjs.com" | ||
BETA_SUFFIX: 'testbeta' | ||
CDN_AWS_PUBLISH_ROLE: arn:aws:iam::654344198836:role/github-actions-oidc-role-nonprod-sign-embedded | ||
CDN_BUCKET: cdn.staging-hellosign.com | ||
CDN_PATH: public/js/embedded | ||
AWS_REGION: us-east-1 | ||
jobs: | ||
build: | ||
permissions: | ||
id-token: write # This is required for requesting the JWT | ||
contents: write # This is required for publishing releases | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [16.x] # we should pull this from a common place | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
registry-url: ${{ env.NPM_REGISTRY_URL }} | ||
|
||
- name: Build | ||
run: | | ||
npm install | ||
npm run build | ||
- name: Test | ||
run: | | ||
npm test | ||
- name: Validate Semver | ||
id: version | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: .github/actions-scripts/validate-release-version.js | ||
|
||
- name: Announce version | ||
run: | | ||
echo "v${{ steps.version.outputs.version }} is the proposed new version." | ||
- name: Pack | ||
run: | | ||
npm pack --pack-destination="./umd" | ||
- name: Publish (dry-run) | ||
run: | | ||
npm publish --dry-run --access=public | ||
- name: Configure AWS credentials for Non-Prod | ||
id: awskeys | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: ${{ env.CDN_AWS_PUBLISH_ROLE }} | ||
aws-region: ${{ env.AWS_REGION }} | ||
|
||
- name: Copy dev build to nonprod cdn | ||
run: aws s3 cp umd/embedded.development.js s3://${{ env.CDN_BUCKET }}/${{ env.CDN_PATH }}/v${{ steps.version.outputs.value }}-${{ env.BETA_SUFFIX }}/ | ||
|
||
- name: Copy minified build to nonprod cdn | ||
run: aws s3 cp umd/embedded.production.min.js s3://${{ env.CDN_BUCKET }}/${{ env.CDN_PATH }}/v${{ steps.version.outputs.value }}-${{ env.BETA_SUFFIX }}/ | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters