on:
  push:
    branches:
      - main
jobs:
  deploy:
    runs-on: ubuntu-latest
    env:
        SAM_CLI_TELEMETRY: 0
        stack_name: entu-api-prod
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v3
      - uses: actions/setup-node@v3
        with:
            node-version: 14
      - uses: aws-actions/setup-sam@v2
      - 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-central-1
      - run: npm ci --quiet --production
      - run: cp -LRv ./node_modules ./src/layers/nodejs/
      - run: sam build --use-container
      - run: sam deploy --no-confirm-changeset --no-fail-on-empty-changeset --capabilities CAPABILITY_IAM --stack-name ${{ env.stack_name }} --s3-bucket ${{ secrets.AWS_S3_BUCKET }}

on:
  push:
    branches:
      - main
jobs:
  deploy:
    runs-on: ubuntu-latest
    env:
        SAM_CLI_TELEMETRY: 0
        stack_name: entu-api-${{ github.ref_name }}
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v3
      - uses: actions/setup-node@v3
        with:
            node-version: 14
      - uses: aws-actions/setup-sam@v2
      - 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-central-1
      - run: npm ci --quiet --production
      - run: cp -LRv ./node_modules ./src/layers/nodejs/
      - run: sam build --use-container
      - run: sam deploy --no-confirm-changeset --no-fail-on-empty-changeset --capabilities CAPABILITY_IAM --stack-name ${{ env.stack_name }} --s3-bucket ${{ secrets.AWS_S3_BUCKET }}

Set stack name same as branch
Set stack name same as branch
