GithubHelp home page GithubHelp logo

apalchys / deployment-action Goto Github PK

View Code? Open in Web Editor NEW

This project forked from altinukshini/deployment-action

0.0 0.0 0.0 563 KB

GitHub action to create a Deployment

License: MIT License

TypeScript 39.20% JavaScript 60.80%

deployment-action's Introduction

deployment-action

A GitHub action to create Deployments as part of your GitHub CI workflows.

Action inputs

name description
pr (optional - default is false) If Deployment is being created from a PR
pr_id (optional) Pass the PR ID to this param if pr is set to "true"
transient_environment (optional - default is false) Set this deployment as transient
initial_status (Optional) Initial status for the deployment. Must be one of the accepted strings
token GitHub token
target_url (Optional) The target URL. This should be the URL of the app once deployed
description (Optional) A description to give the environment
auto_merge (Optional - default is false) Whether to attempt to auto-merge the default branch into the branch that the action is running on if set to "true". More details in the GitHub deployments API. Warning - setting this to "true" has caused this action to fail in some cases
ref (Optional) The ref to deploy. This can be a branch, tag, or SHA. More details in the GitHub deployments API.

Action outputs

name description
deployment_id The ID of the deployment as returned by the GitHub API

Example usage

name: Deploy

on: [push]

jobs:
  deploy:
    name: Deploy my app

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1

      - uses: altinukshini/deployment-action@releases/v1
        name: Create GitHub deployment
        id: deployment
        with:
          token: "${{ github.token }}"
          target_url: http://my-app-url.com
          environment: production
        # more steps below where you run your deployment scripts inside the same action

Notes

Heads up! Currently, there is a GitHub Actions limitation where events fired inside an action will not trigger further workflows. If you use this action in your workflow, it will not trigger any "Deployment" workflows. Thanks to @rclayton-the-terrible for finding a workaround for this:

While not ideal, if you use a token that is not the Action's GITHUB_TOKEN, this will work. I define a secret called GITHUB_DEPLOY_TOKEN and use that for API calls.

A workaround for this is to create the Deployment, perform the deployment steps, and then trigger an action to create a Deployment Status using my other action: chrnorm/deployment-status.

For example:

name: Deploy

on: [push]

jobs:
  deploy:
    name: Deploy my app

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1

      - uses: altinukshini/deployment-action@releases/v1
        name: Create GitHub deployment
        id: deployment
        with:
          token: "${{ github.token }}"
          target_url: http://my-app-url.com
          environment: production

      - name: Deploy my app
        run: |
          # add your deployment code here

      - name: Update deployment status (success)
        if: success()
        uses: altinukshini/deployment-status@releases/v1
        with:
          token: "${{ github.token }}"
          target_url: http://my-app-url.com
          state: "success"
          deployment_id: ${{ steps.deployment.outputs.deployment_id }}

      - name: Update deployment status (failure)
        if: failure()
        uses: altinukshini/deployment-status@releases/v1
        with:
          token: "${{ github.token }}"
          target_url: http://my-app-url.com
          state: "failure"
          deployment_id: ${{ steps.deployment.outputs.deployment_id }}

deployment-action's People

Contributors

altinukshini avatar chrnorm avatar dependabot[bot] avatar localheinz avatar shallwefootball 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.