Test: update #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go-version: [ '1.23' ] | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23' | |
cache-dependency-path: subdir/go.sum | |
- name: Install dependencies | |
run: go mod tidy | |
- name: Run tests | |
run: go test ./... | |
- name: Debug GitHub directory | |
run: ls -R | |
# Setup AWS Credentials | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | |
role-session-name: GitHubActions | |
aws-region: us-east-1 | |
- name: Verify AWS Credentials | |
run: aws sts get-caller-identity | |
# Ensure Lambda function source exists before CDK build | |
- name: Ensure Lambda Code Exists | |
run: | | |
mkdir -p bin/lambda | |
cp -r bin/cdk.out/asset.*/pipeline.go bin/lambda/ || echo "Lambda file already exists" | |
# CDK Build | |
- name: Install AWS CDK | |
run: npm install -g aws-cdk | |
- name: CDK Synth | |
run: cdk synth --app "go run bin/cdk.go" | |
env: | |
ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }} | |
# Optionally Deploy CDK Stack | |
- name: CDK Deploy | |
run: cdk deploy --require-approval never | |
env: | |
ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }} | |
# Trigger AWS CodeBuild for Lambda Build | |
- name: Trigger AWS CodeBuild | |
run: aws codebuild start-build --project-name "CodeBuildV1" |