Skip to content

rows/release-action

Repository files navigation

Release action

(another update)

Multiple workflows are required as part of the standard Pony release process that this bot encompasses. You will need 3 different workflow files.

A release is started by tagging the HEAD commit of a repo with a tag that looks like:

release-x.y.z where x.y.z is the version to release; e.g. 0.1.0

When the tag is pushed, it will trigger the start-a-release section of the workflow below. See scripts/start-a-release.bash for full-details. When start-a-release finishes, it will delete the release-x.y.z tag and push a new tag x.y.z that triggers the release step.

Each library or application will have it's own release steps that are needed. They should be supplied as a series of steps in a release.yml (see below). Each of those steps will be a requirement to trigger the trigger-release-announcement step.

trigger-release-announcement pushes a new tag announce-x.y.z that will trigger the next and final step in the process. The trigger-release-announcement step exists so that if any build artifact portion of the release process fails, it can be completed by hand and then, a human can push a announce-x.y.z tag to start the final step in the release process.

announce-a-release will post:

  • Post the release notes to the release section of GitHub
  • Post a notification of the release to the #announce stream on Zulip
  • Add a notice to the open Last Week in Pony issue

Once announce-a-release has completed, the release process is done. For more in-depth details, please see each of the respective scripts in scripts.

Example workflows

start-a-release

Starts the release process.

Requires that your repo have Pony standard CHANGELOG and VERSION files.

start-a-release.yml:

name: Start a release

on:
  push:
    tags: release-\d+.\d+.\d+

jobs:
  start-a-release:
    name: Start a release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: Start
        uses: ponylang/[email protected]
        with:
          step: start-a-release
          git_user_name: "Ponylang Main Bot"
          git_user_email: "[email protected]"
        env:
          RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}

trigger-release-announcement

Triggers the announcement of the release.

Should be run after all release artifact building steps are done. For an application, this would mean that all artifacts have been uploaded to Cloudsmith and any Docker images were built.

release.yml:

name: Release

on:
  push:
    tags:
      - \d+.\d+.\d+

jobs:
  # Artifact building steps go here

  trigger-release-announcement:
    name: Trigger release announcement
    runs-on: ubuntu-latest
    needs: [ARTIFACT_BUILDING_STEPS_HERE]
    steps:
      - uses: actions/checkout@v1
      - name: Trigger
        uses: ponylang/[email protected]
        with:
          step: trigger-release-announcement
          git_user_name: "Ponylang Main Bot"
          git_user_email: "[email protected]"
        env:
          RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}

trigger-release-announcement, by default, will extract the version being released from the GITHUB_REF environment variable. For this default action to work, trigger-release-announcement must be kicked off by a tag being pushed. If you set up the step to be triggered in any other fashion it will not work unless you supply the version yourself. You can supply the version by providing an optional environment variable VERSION set to the version being released.

announce-a-release

Announces a release after artifacts have been built:

  • Publishes release notes to GitHub
  • Announces in the #announce stream of Zulip
  • Adds a note about the release to LWIP

announce-a-release.yml:

name: Announce a release

on:
  push:
    tags: announce-\d+.\d+.\d+

jobs:
  announce-a-release:
    name: Announce a release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: Announce
        uses: ponylang/[email protected]
        with:
          step: announce-a-release
          git_user_name: "Ponylang Main Bot"
          git_user_email: "[email protected]"
        env:
          RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
          ZULIP_TOKEN: ${{ secrets.ZULIP_TOKEN }}

N.B. The environment variable RELEASE_TOKEN that is required by each step must be a personal access token with public_repo access. You can not use the GITHUB_TOKEN environment variable provided by GitHub's action environment. If you try to use GITHUB_TOKEN, no additional steps will trigger after start-a-release has completed.

N.B. This action assumes that the default branch of your repository is named main. If it isn't named main, you will need to override that with an optional input parameter default_branch.

For example, if your repository's default branch is called trunk, instead of having something like:

        with:
          step: announce-a-release
          git_user_name: "Ponylang Main Bot"
          git_user_email: "[email protected]"

you would update to:

        with:
          step: announce-a-release
          git_user_name: "Ponylang Main Bot"
          git_user_email: "[email protected]"
          default_branch: "trunk"