GithubHelp home page GithubHelp logo

isabella232 / project-card-release-automation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from adobe/project-card-release-automation

0.0 0.0 0.0 975 KB

License: Apache License 2.0

Shell 1.40% JavaScript 98.60%

project-card-release-automation's Introduction

Project Card Release Automation

javscript-action status

This repo contains a set of Github actions that can be used to automate release processes using semantic versioning of projects with a versioned package.json. The actions work off of a Github issue created for each release version, a card put into a Github project, and finally a Github release record.

General overview

To use these actions in your repo follow these setup steps:

  1. Create a Github project with columns "New", "Alpha", "Beta", and "Release"
  2. Create workflows for initializing a release, triggering a release, and deploying a release. These are detailed more below.

Once implemented in your repo, the general release process would look like this:

  1. Decide on what kind of release you want to do (major, minor, or patch), and which branch you would like to work off of.
  2. Manually run a workflow to initialize a release issue and project card with the target version. The new card should appear in the "New" column of the Github project. The new issue will have a title corresponding to the desired release number (i.e. "1.2.0")
  3. Move the card to the "Alpha" column. This will trigger a prerelease version build (i.e. "1.2.0-alpha.0")
  4. Now new commits or PR merges to the branch will trigger a new prerelease build (i.e. "1.2.0-alpha.1")
  5. When all the features for the targeted release are complete, move the project card to the "Beta" column. This will trigger a beta build (i.e. "1.2.0-beta.0")
  6. New commits or PR merges to the branch will trigger a new beta build (i.e. "1.2.0-beta.1")
  7. when you are satisfied with the release, move the project card to "Release". This triggers a release build (i.e. "1.2.0")
  8. Start the process again for the next release.

Setting up the Github workflows

First create the workflow you will use to create the issue and release card. Be sure to replace the projectNumber.

name: Initialize Intended Release
on:
  workflow_dispatch:
    inputs:
      type:
        description: "Release Type [major|minor|patch]"
        required: true

jobs:
  initializeIntendedRelease:
    name: "Initialize Intended Release"
    runs-on: ubuntu-latest
    steps:
      - uses: adobe/project-card-release-automation/initialize-card@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          releaseType: ${{ github.event.inputs.type }}
          projectNumber: 1

Next create the workflow to run the release process:

name: Deploy Release
on:
  workflow_dispatch:
    inputs:
      version:
        description: "Version"
        required: true

jobs:
  release:
    name: "Release"
    runs-on: ubuntu-latest
    steps:
      - uses: adobe/project-card-release-automation/validate-version@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          version: ${{ github.event.inputs.version }}
      - uses: actions/checkout@v2
      - run: |
          git config user.name $GITHUB_ACTOR
          git config user.email gh-actions-${GITHUB_ACTOR}@github.com
          git remote add gh-origin https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git/
          npm version ${{ github.event.inputs.version }}
          git push gh-origin HEAD:${GITHUB_REF} --follow-tags
      - uses: adobe/project-card-release-automation/record-release@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          version: ${{ github.event.inputs.version }}

The run step in the workflow code above simply increments the version in package.json, and commits the change. This is where you would put the logic to preform the release process for your repo.

Next create the workflow to trigger releases:

name: Trigger Release
on:
  project_card:
    types: [moved]
  push:
    branches:
      - "main"
  workflow_dispatch:

jobs:
  triggerReleaseIfNeeded:
    name: "Trigger Release If Needed"
    runs-on: ubuntu-latest
    steps:
      - uses: adobe/project-card-release-automation/trigger-release@v1
        with:
          token: ${{ secrets.BOT_GITHUB_TOKEN }}
          workflowId: "deployRelease.yml"
          projectNumber: 1

You can change the branch section to only trigger based on the branches that you will use for releases. Be sure to change the workflowId to be the name of the deploy release YAML file, and change the projectNumber as before. This workflow triggers when a project card is moved, when new commits are pushed, or when the workflow is dispatched manually.

Development

Install the dependencies

npm install

Run the tests:

npm test

Build the combined javascript files with ncc:

npm run build

Contributing

Contributions are welcomed! Read the Contributing Guide for more information.

Licensing

This project is licensed under the Apache V2 License. See LICENSE for more information.

project-card-release-automation's People

Contributors

dependabot[bot] avatar jonsnyder 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.