mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-23 07:19:50 -04:00
Add authorization and deployment to the ci file
This commit is contained in:
parent
4c5809c8a5
commit
4a72dd531e
@ -1,16 +1,16 @@
|
|||||||
stages:
|
stages:
|
||||||
- test
|
- test
|
||||||
- build
|
- build
|
||||||
|
- staging
|
||||||
|
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
image: node:14.5.0
|
image: node:14.5.0
|
||||||
variables:
|
variables:
|
||||||
NODE_OPTIONS: '--max_old_space_size=2048'
|
NODE_OPTIONS: "--max_old_space_size=2048"
|
||||||
script:
|
script:
|
||||||
- cd ./src
|
- cd ./src
|
||||||
- npm ci
|
- make build
|
||||||
- npm run-script build
|
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- ./src/dist/dynamicbible
|
- ./src/dist/dynamicbible
|
||||||
@ -19,9 +19,19 @@ test:
|
|||||||
stage: test
|
stage: test
|
||||||
image: walljm/node-chrome-headless:14.8.0
|
image: walljm/node-chrome-headless:14.8.0
|
||||||
variables:
|
variables:
|
||||||
NODE_OPTIONS: '--max_old_space_size=2048'
|
NODE_OPTIONS: "--max_old_space_size=2048"
|
||||||
script:
|
script:
|
||||||
- cd ./src
|
- cd ./src
|
||||||
- npm ci
|
- make test
|
||||||
- npm run-script lint
|
|
||||||
- npm run-script test-headless
|
deploy-staging:
|
||||||
|
stage: staging
|
||||||
|
variables:
|
||||||
|
- gcloud_service_account_email
|
||||||
|
- gcloud_service_account_key
|
||||||
|
script:
|
||||||
|
- make deploy-staging
|
||||||
|
rules:
|
||||||
|
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||||
|
when: on_success
|
||||||
|
allow_failure: false
|
||||||
|
14
src/Makefile
14
src/Makefile
@ -1,17 +1,21 @@
|
|||||||
output := dist/dynamicbible/
|
output := dist/dynamicbible/
|
||||||
|
|
||||||
test:
|
test:
|
||||||
|
npm ci
|
||||||
|
npm run-script lint
|
||||||
npm run-script test-headless
|
npm run-script test-headless
|
||||||
|
|
||||||
# For some reason karma is unable to connect to the browser here.
|
build:
|
||||||
# I don't want to debug so not using test as a dependency.
|
npm ci
|
||||||
build: test
|
|
||||||
npm run-script build
|
npm run-script build
|
||||||
|
|
||||||
deploy-prod: build
|
authorize-service-account:
|
||||||
|
gcloud auth activate-service-account ${gcloud_service_account_email} --key-file=${gcloud_service_account_key} | tee authorize.log
|
||||||
|
|
||||||
|
deploy-prod: build authorize-service-account
|
||||||
gsutil -m rsync -d -r ${output} gs://dynamicbible.com
|
gsutil -m rsync -d -r ${output} gs://dynamicbible.com
|
||||||
|
|
||||||
deploy-staging: build
|
deploy-staging: build authorize-service-account
|
||||||
gsutil -m rsync -d -r ${output} gs://staging.dynamicbible.com
|
gsutil -m rsync -d -r ${output} gs://staging.dynamicbible.com
|
||||||
|
|
||||||
update-bucket-configs: gcloud/buckets.yaml
|
update-bucket-configs: gcloud/buckets.yaml
|
||||||
|
@ -35,15 +35,11 @@ resources:
|
|||||||
role: WRITER
|
role: WRITER
|
||||||
- entity: "project-viewers-dynamicbible-7c6cf"
|
- entity: "project-viewers-dynamicbible-7c6cf"
|
||||||
role: READER
|
role: READER
|
||||||
|
- entity: "user-$(ref.gitlab-service-account.email)"
|
||||||
|
role: WRITER
|
||||||
defaultObjectAcl:
|
defaultObjectAcl:
|
||||||
- entity: allUsers
|
- entity: allUsers
|
||||||
role: READER
|
role: READER
|
||||||
accessControl:
|
|
||||||
gcpIamPolicy:
|
|
||||||
bindings:
|
|
||||||
- role: roles/dynamicbible_publish
|
|
||||||
members:
|
|
||||||
- "serviceAccount:$(ref.gitlab-service-account.email)"
|
|
||||||
- name: gitlab-service-account
|
- name: gitlab-service-account
|
||||||
type: iam.v1.serviceAccount
|
type: iam.v1.serviceAccount
|
||||||
properties:
|
properties:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user