Coder Social home page Coder Social logo

aws-cdk-github-actions's Introduction

Warning

This action has been archived. It's generally just better to run cdk directly, e.g. by doing yarn global add aws-cdk then run: cdk deploy ... etc.

The problems with this action are:

  • It downloads a massive Docker image at the start of each run (the original project—which has also been archived—would build the image on each run which was even slower)
  • It freezes the version of all the dependencies like the rust compiler, cargo-lambda etc. such that they can only be updated by updating the Docker image (or setting up some automation to generate a bunch of different images with different versions etc.)
  • If any of your CDK constructs use Docker to build you end up running Docker inside Docker which causes problems like requiring you to use BundlingFileAccess.VOLUME_COPY in your bundling options for things like S3 Assets.

AWS CDK GitHub Actions

AWS CDK GitHub Actions allow you to run cdk deploy and cdk diff and ... on your pull requests to help you review.

This is a fork of youyo/aws-cdk-github-actions that:

  • Builds using an environment that more closely resembles Amazon Linux 2023 so it is possible to build binary components using the same libc and deploy them.
  • Installs esbuild for faster building.
  • Drops support for building Python requirements.
  • Adds cargo lambda with ARM target so you can build ARM-based Rust lambdas. The rust version is currently fixed as part of the Docker image to improve build time.
  • Uses a pre-built Docker image so that GitHub Actions don't need to re-build it every time.

Supported languages

  • TypeScript
  • JavaScript

Example usage

on: [push]

jobs:
  aws_cdk:
    runs-on: ubuntu-latest
    steps:
      - name: cdk diff
        uses: birchill/[email protected]
        with:
          cdk_subcommand: 'diff'
          actions_comment: true
        env:
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          AWS_DEFAULT_REGION: 'ap-northeast-1'

      - name: cdk deploy
        uses: birchill/[email protected]
        with:
          cdk_subcommand: 'deploy'
          cdk_stack: 'stack1'
          cdk_args: '--require-approval never'
          actions_comment: false
        env:
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          AWS_DEFAULT_REGION: 'ap-northeast-1'

      - name: cdk synth
        uses: birchill/[email protected]
        with:
          cdk_subcommand: 'synth'
          cdk_version: '1.16.2'
          working_dir: 'src'
        env:
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          AWS_DEFAULT_REGION: 'ap-northeast-1'

With OIDC

on: [push]

jobs:
  aws_cdk:
    runs-on: ubuntu-latest
    steps:
      - name: Configure AWS credentials
        uses: aws-actions/configure-aws-credentials@v3
        with:
          role-to-assume: ${{ secrets.ROLE_ARN }}
          role-session-name: github-actions
          aws-region: ap-northeast-1

      - name: cdk diff
        uses: birchill/[email protected]
        with:
          cdk_subcommand: 'diff'

Inputs

  • cdk_subcommand Required AWS CDK subcommand to execute.
  • cdk_version AWS CDK version to install. (default: 'latest')
  • cdk_stack AWS CDK stack name to execute. (default: '*')
  • working_dir AWS CDK working directory. (default: '.')
  • actions_comment Whether or not to comment on pull requests. (default: true)
  • debug_log Enable debug-log. (default: false)

Outputs

  • status_code Returned status code.

Environment

  • AWS_ACCESS_KEY_ID Required unless using configure-aws-credentials
  • AWS_SECRET_ACCESS_KEY Required unless using configure-aws-credentials
  • GITHUB_TOKEN Required for actions_comment=true

A GitHub token is automatically made available as a secret as GITHUB_TOKEN.

License

MIT

Original author

youyo

aws-cdk-github-actions's People

Contributors

almcc avatar birtles avatar dumastaylorpfg avatar g-farrow avatar graybrandonpfg avatar hg-jarlinghaus avatar pizzaminded avatar youyo avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.