Giter VIP home page Giter VIP logo

aws-codepipeline-action's Introduction

AWS CodePipeline using GitHub Actions

This GitHub Actions will help you trigger a pipeline in your AWS CodePipeline - assumming you already have the pipeline. This will not create the pipeline for you.

Setup

AWS IAM

Create an IAM user with codepipeline:StartPipelineExecution permission. You may take and customize the IAM policy below as starter point. Note that I'm using "*" in the policy. For better security, you can use AWS CodePipeline ARN. You can read more about IAM for CodePipeline here.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "codepipeline:StartPipelineExecution"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}

GitHub Secrets

After you create the IAM user with the right permission, add two variables below in your GitHub repository secrets area:

  • AWS_ACCESS_KEY_ID: the Access Key ID for the user that you just created
  • AWS_SECRET_ACCESS_KEY: the Secret Key for the user that you just created

Usage

Basic Usage

Note:

  • Please check the latest available version here and replace it with v1.0 in the code examples below.
jobs:
  deploy:
    steps:
      - name: Trigger AWS CodePipeline
        uses: rexsateesh/[email protected]
        with:
          aws-region: "ap-southeast-1"
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          pipeline-name: "your-pipeline-name"

Advance Usage

Below is the example for situation where:

  • You only want to trigger the pipeline if previous job was successful
  • You only want to trigger the pipeline if the Git branch that GitHub Actions currently running is a specific branch
jobs:
  job1:
    ... code for job1 ...
  deploy:
    needs: job1
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Trigger AWS CodePipeline
        uses: rexsateesh/[email protected]
        if: github.ref == 'refs/heads/your-branch-name'
        with:
          aws-region: "ap-southeast-1"
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          pipeline-name: "your-pipeline-name"

Contribute

Feel free to fork and submit PRs for this project. I'm more than happy to review and merge it. If you have any questions regarding contributing, feel free to reach out to me on Twitter.

aws-codepipeline-action's People

Contributors

rexsateesh 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.