configure AWS S3 credentials to upload standard components

This commit is contained in:
Martin McKeaveney 2021-05-26 17:04:32 +01:00
parent 88a35ecf81
commit 8585618736
2 changed files with 9 additions and 9 deletions

View File

@ -24,6 +24,13 @@ jobs:
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
- run: yarn test
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
- name: Publish budibase packages to NPM
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

View File

@ -4,7 +4,6 @@ const fs = require("fs")
const TO_SYNC = "dist/"
const BUCKET_LOCATION = "s3://prod-budi-app-assets/assets"
const BASE_PROFILE = "budibase"
const S3_COMP_DIR = "@budibase/standard-components/dist"
const MANIFEST = "componentlibrary-latest.json"
@ -13,10 +12,6 @@ function buildS3Path() {
}
async function run() {
let profile = process.env.AWS_PROFILE
if (profile == null) {
profile = BASE_PROFILE
}
// basic manifest file describing the latest
fs.writeFileSync(
MANIFEST,
@ -25,10 +20,8 @@ async function run() {
dir: S3_COMP_DIR,
})
)
execSync(`aws s3 sync ${TO_SYNC} ${buildS3Path()} --profile ${profile}`)
execSync(
`aws s3 cp ${MANIFEST} ${BUCKET_LOCATION}/${MANIFEST} --profile ${profile}`
)
execSync(`aws s3 sync ${TO_SYNC} ${buildS3Path()}`)
execSync(`aws s3 cp ${MANIFEST} ${BUCKET_LOCATION}/${MANIFEST}`)
fs.unlinkSync(MANIFEST)
}