CI: removing npm token on build

This commit is contained in:
Arthur Simas
2022-07-06 11:55:19 -03:00
parent 65b2578f15
commit 2c099ba491
5 changed files with 10 additions and 26 deletions
+1 -5
View File
@@ -35,9 +35,7 @@ jobs:
semantic_release: semantic_release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
#new_release_published: ${{ steps.semantic.outputs.last_release_version != steps.semantic.outputs.new_release_version }}
new_release_published: ${{ steps.semantic.outputs.new_release_published }} new_release_published: ${{ steps.semantic.outputs.new_release_published }}
#new_release_version: ${{ steps.semantic.outputs.new_release_version }}
new_release_version: ${{ (steps.semantic.outputs.new_release_published == 'true' && steps.semantic.outputs.new_release_version) || (github.event_name == 'workflow_dispatch' && '0.0.0') }} new_release_version: ${{ (steps.semantic.outputs.new_release_published == 'true' && steps.semantic.outputs.new_release_version) || (github.event_name == 'workflow_dispatch' && '0.0.0') }}
steps: steps:
- name: Checkout - name: Checkout
@@ -57,7 +55,6 @@ jobs:
] ]
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
deploy: deploy:
if: ${{ github.event_name == 'workflow_dispatch' || needs.semantic_release.outputs.new_release_published == 'true' }} if: ${{ github.event_name == 'workflow_dispatch' || needs.semantic_release.outputs.new_release_published == 'true' }}
@@ -107,9 +104,8 @@ jobs:
ENV: ${{ needs.extract_environment.outputs.environment }} ENV: ${{ needs.extract_environment.outputs.environment }}
IMAGE_TAG: ${{ needs.semantic_release.outputs.new_release_version }} IMAGE_TAG: ${{ needs.semantic_release.outputs.new_release_version }}
ACCOUNT_ID: ${{ steps.aws.outputs.aws-account-id }} ACCOUNT_ID: ${{ steps.aws.outputs.aws-account-id }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: | run: |
docker-compose -f build.docker-compose.yml build --build-arg NPM_TOKEN=${NPM_TOKEN} docker-compose -f build.docker-compose.yml build
docker-compose -f build.docker-compose.yml push docker-compose -f build.docker-compose.yml push
- name: Create ZIP file to Deploy AWS Beanstalk - name: Create ZIP file to Deploy AWS Beanstalk
+3 -6
View File
@@ -2,8 +2,6 @@ name: Test
on: on:
pull_request: pull_request:
branches: branches:
- alpha
- beta
- main - main
jobs: jobs:
@@ -21,23 +19,22 @@ jobs:
env: env:
ENV: test ENV: test
IMAGE_TAG: test IMAGE_TAG: test
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: | run: |
export ENV=test export ENV=test
export IMAGE_TAG=test export IMAGE_TAG=test
export ACCOUNT_ID=test export ACCOUNT_ID=test
docker-compose -f build.docker-compose.yml build --build-arg NPM_TOKEN=${NPM_TOKEN} docker-compose -f build.docker-compose.yml build
- name: Run Test - name: Run Test
env: env:
ENV: test ENV: test
IMAGE_TAG: test IMAGE_TAG: test
ACCOUNT_ID: test ACCOUNT_ID: test
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} APP_NAME: ${{ github.event.repository.name }}
run: | run: |
export ENV=test export ENV=test
export IMAGE_TAG=test export IMAGE_TAG=test
docker-compose -f build.docker-compose.yml run -e NPM_TOKEN=${NPM_TOKEN} --rm --entrypoint="npm run test" maestro docker-compose -f build.docker-compose.yml run --rm --entrypoint="npm run test" $APP_NAME
- name: Remove Docker's Trash - name: Remove Docker's Trash
if: always() if: always()
-1
View File
@@ -1 +0,0 @@
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
-1
View File
@@ -26,7 +26,6 @@
"preset": "eslint" "preset": "eslint"
} }
], ],
"@semantic-release/npm",
"@semantic-release/github" "@semantic-release/github"
] ]
} }
+6 -13
View File
@@ -1,23 +1,16 @@
FROM node:18.3.0-alpine3.15 as packages FROM node:18.3.0-alpine3.15 as packages
WORKDIR /packages WORKDIR /packages
ARG NPM_TOKEN
COPY package.json . COPY package.json .
COPY package-lock.json . COPY package-lock.json .
COPY .npmrc . RUN apk update \
&& apk add --no-cache aws-cli \
&& aws codeartifact login --tool npm --repository dadosfera-npm --domain dadosfera --domain-owner 611330257153 --region us-east-1 \
&& npm install
RUN apk update && apk add curl unzip FROM node:18.3.0-alpine3.15
RUN apk add --no-cache aws-cli
RUN aws codeartifact login --tool npm --repository dadosfera-npm --domain dadosfera --domain-owner 611330257153 --region us-east-1
RUN npm install
RUN rm -f ./.npmrc
FROM node:14.15.4-alpine3.12
WORKDIR /app WORKDIR /app
COPY . /app/ COPY . /app/
ARG NPM_TOKEN
COPY --from=packages /packages/node_modules /app/node_modules COPY --from=packages /packages/node_modules /app/node_modules
RUN npm run build RUN npm run build
EXPOSE 3333 EXPOSE 3333
ENTRYPOINT npm run start ENTRYPOINT npm run start