Closed GABAnich closed 3 years ago
@GABAnich I think the issue is with your Github Action setup. This file is running the test
, build
, and deploy
steps in parallel so obviously if the project isn't built and node modules aren't installed by the time you try to deploy that will be an issue.
Adding needs: test
to the build step and needs: build
to the deploy step should solve your issue
build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: TractorZoom/sam-cli-action@master
with:
sam_command: "build"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 12
uses: actions/setup-node@v1
with:
version: 12
- run: npm ci
- uses: TractorZoom/sam-cli-action@master
with:
sam_command: "deploy --parameter-overrides TelegramToken=${{ secrets.TELEGRAM_TOKEN }}"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
@cody-hoffman
Thanks a lot! :tada:
Now my CI/CD looks next:
name: CICD
on:
push:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 12
uses: actions/setup-node@v1
with:
version: 12
- run: npm ci
- run: npm run eslint
- run: npm run test
env:
CI: true
build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: TractorZoom/sam-cli-action@master
with:
sam_command: "build"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- uses: TractorZoom/sam-cli-action@master
with:
sam_command: "deploy --parameter-overrides TelegramToken=${{ secrets.TELEGRAM_TOKEN }}"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
Describe the bug Actions deploy code without
node_moduls
My actions file