Skip to content

fix feature branch build. #3

fix feature branch build.

fix feature branch build. #3

name: Feature Branch
on:
workflow_dispatch:
push:
branches:
- feature/*
jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Setup job workspace
uses: ServerlessOpsIO/gha-setup-workspace@v1
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Yarn via corepack
shell: bash
run: corepack enable
- name: Install dependencies
shell: bash
run: yarn install --immutable
- name: Assume AWS Credentials
uses: ServerlessOpsIO/gha-assume-aws-credentials@v1
with:
build_aws_account_id: ${{ secrets.AWS_CICD_ACCOUNT_ID }}
- name: Install AWS SAM
uses: aws-actions/setup-sam@v2
- name: Validate template
run: sam validate --lint
# TODO: Need to run tests when we have them
- name: Compile Typescript
run: yarn run build
- name: Build artifact
run: yarn run sam:build
- name: Store Artifacts
uses: ServerlessOpsIO/gha-store-artifacts@v1
with:
use_aws_sam: true
- name: 'Upload pipeline artifact 1'
id: upload-artifact
uses: actions/upload-artifact@v4
with:
path: template.yaml
if-no-files-found: error
retention-days: 1
- name: 'Upload pipeline artifact 2'
id: upload-artifact-2
uses: actions/upload-artifact@v4
with:
path: README.md
if-no-files-found: error
retention-days: 1
deploy:
# Disableing until a full workflow for feature branches is figured out.
if: false
needs:
- build
environment: production
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Setup job workspace
uses: ServerlessOpsIO/gha-setup-workspace@v1
with:
checkout_artifact: true
- name: Assume AWS Credentials
uses: ServerlessOpsIO/gha-assume-aws-credentials@v1
with:
build_aws_account_id: ${{ secrets.AWS_CICD_ACCOUNT_ID }}
deploy_aws_account_id: ${{ secrets.DEPLOYMENT_ACCOUNT_ID }}
- name: Deploy via AWS SAM
uses: ServerlessOpsIO/gha-deploy-aws-sam@v1
with:
aws_account_id: ${{ secrets.DEPLOYMENT_ACCOUNT_ID }}
env_json: ${{ toJson(env) }}
secrets_json: ${{ toJson(secrets) }}