Skip to content

Bump @types/node from 20.3.1 to 20.5.9 in /infra #220

Bump @types/node from 20.3.1 to 20.5.9 in /infra

Bump @types/node from 20.3.1 to 20.5.9 in /infra #220

Workflow file for this run

on:
push:
branches:
- main
pull_request:
env:
AWS_REGION: us-west-2
permissions:
id-token: write
contents: read
name: deploy
jobs:
build_lambdas:
strategy:
matrix:
go-version:
- 1.20.5
cdk-version:
- 2.84.0
runs-on: ubuntu-latest
steps:
- name: install go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: checkout code
uses: actions/checkout@v3
- name: go build
env:
CGO_ENABLED: "0"
GOOS: linux
run: |
mkdir build
go build -a -ldflags='-extldflags=-static' -o ./build/ ./lambdas/...
- name: archive built binaries
uses: actions/upload-artifact@v3
with:
name: binaries
path: ${{ github.workspace }}
cdk_diff:
if: github.ref != 'refs/heads/main'
needs: [build_lambdas]
runs-on: ubuntu-latest
steps:
- name: download binaries
id: download
uses: actions/download-artifact@v3
with:
name: binaries
path: ${{ github.workspace }}
- name: fix executable permissions
run: chmod 755 -R ${{ github.workspace }}/build
- name: install dependencies
working-directory: infra
run: npm install
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::635281304921:role/github-cdk-deploy
aws-region: us-west-2
- name: cdk diff
working-directory: infra
run: npx cdk diff
env:
AWS_DEFAULT_REGION: "us-west-2"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
cdk_deploy:
if: github.ref == 'refs/heads/main'
needs: [build_lambdas]
runs-on: ubuntu-latest
steps:
- name: download binaries
id: download
uses: actions/download-artifact@v3
with:
name: binaries
path: ${{ github.workspace }}
- name: fix executable permissions
run: chmod 755 -R ${{ github.workspace }}/build
- name: install dependencies
working-directory: infra
run: npm install
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::635281304921:role/github-cdk-deploy
aws-region: us-west-2
- name: cdk deploy
working-directory: infra
run: npx cdk deploy --require-approval never
env:
AWS_DEFAULT_REGION: "us-west-2"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build_registration_script:
runs-on: ubuntu-latest
steps:
- name: install go
uses: actions/setup-go@v3
with:
go-version: 1.20.1
- name: checkout code
uses: actions/checkout@v3
- name: go build
env:
CGO_ENABLED: "0"
GOOS: linux
run: |
mkdir build
go build -a -ldflags='-extldflags=-static' -o ./build/ ./cmd/...
- name: archive built binaries
uses: actions/upload-artifact@v3
with:
name: binaries
path: ${{ github.workspace }}
register_discord_commands:
needs: [build_registration_script, cdk_deploy]
runs-on: ubuntu-latest
steps:
- name: download binaries
id: download
uses: actions/download-artifact@v3
with:
name: binaries
path: ${{ github.workspace }}
- name: fix executable permissions
run: chmod 755 -R ${{ github.workspace }}/build
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::635281304921:role/github-cdk-deploy
aws-region: us-west-2
- name: fetch discord token from secrets manager
env:
AWS_DEFAULT_REGION: "us-west-2"
run: |
export DISCORD_TOKEN=$(aws secretsmanager get-secret-value --secret-id discord-interactions-api --query SecretString --output text | jq -r .DISCORD_TOKEN)
echo "::add-mask::${DISCORD_TOKEN}"
echo "DISCORD_TOKEN=${DISCORD_TOKEN}" >> $GITHUB_ENV
- name: run register
env:
GUILD_ID: ${{ vars.GUILD_ID }}
APP_ID: ${{ vars.DISCORD_APP_ID }}
CLEAN: true
run: build/register-discord-interactions