Skip to content

Commit

Permalink
ci: Add release workflow (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
radeksimko authored Dec 6, 2023
1 parent b22ec09 commit 9bbc98c
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 30 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Release

on:
workflow_dispatch:
inputs:
version:
description: 'Version (excl. prefix v)'
required: true
type: string
sha:
description: 'SHA (long version; 40 chars)'
required: true
type: string
branch:
description: 'Branch'
type: string
default: main

jobs:
staging:
runs-on: ubuntu-latest
steps:
- name: Setup bob
uses: hashicorp/action-setup-bob@v1
with:
github-token:
${{ secrets.BOB_GITHUB_TOKEN }}
- name: Promote to staging
env:
BOB_GITHUB_TOKEN: ${{ secrets.BOB_GITHUB_TOKEN }}
VERSION: ${{ github.event.inputs.version }}
SHA: ${{ github.event.inputs.sha }}
BRANCH: main
ENVIRONMENT: staging
run: |
bob trigger-promotion \
--product-name=hc-install \
--environment=hc-install-oss \
--org=hashicorp \
--repo=hc-install \
--slack-channel=C01QDH3Q37W \
--product-version=$VERSION \
--sha=$SHA \
--branch=$BRANCH \
$ENVIRONMENT
production:
runs-on: ubuntu-latest
steps:
- name: Setup bob
uses: hashicorp/action-setup-bob@v1
with:
github-token:
${{ secrets.BOB_GITHUB_TOKEN }}
- name: Promote to production
env:
BOB_GITHUB_TOKEN: ${{ secrets.BOB_GITHUB_TOKEN }}
VERSION: ${{ github.event.inputs.version }}
SHA: ${{ github.event.inputs.sha }}
BRANCH: main
ENVIRONMENT: production
run: |
bob trigger-promotion \
--product-name=hc-install \
--environment=hc-install-oss \
--org=hashicorp \
--repo=hc-install \
--slack-channel=C01QDH3Q37W \
--product-version=$VERSION \
--sha=$SHA \
--branch=$BRANCH \
$ENVIRONMENT
33 changes: 3 additions & 30 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,6 @@ Release process:

1. Update [`version/VERSION`](https://github.com/hashicorp/hc-install/blob/main/version/VERSION) to remove `-dev` suffix and set it to the intended version to be released
1. Wait for [`build` workflow](https://github.com/hashicorp/hc-install/actions/workflows/build.yml) to finish
1. Ensure you have the appropriate GitHub PAT set in `BOB_GITHUB_TOKEN` variable
1. Set `SHA` to the corresponding (long) last commit SHA (after updating `VERSION` file) & `VERSION` to the same version
1. Use `bob` to promote artifacts to **staging**
```
bob trigger-promotion \
--product-name=hc-install \
--environment=hc-install-oss \
--org=hashicorp \
--repo=hc-install \
--slack-channel=C01QDH3Q37W \
--product-version=$VERSION \
--sha=$SHA \
--branch=main \
staging
```
6. Use `bob` to promote artifacts to **production**
```
bob trigger-promotion \
--product-name=hc-install \
--environment=hc-install-oss \
--org=hashicorp \
--repo=hc-install \
--slack-channel=C01QDH3Q37W \
--product-version=$VERSION \
--sha=$SHA \
--branch=main \
production
```
7. Wait for a message in the Slack channel saying that authorisation is needed to promote artifacts to production. Click on the link and approve.
8. Once notified that promotion is successful, go to https://github.com/hashicorp/crt-workflows-common/actions/workflows/promote-production-packaging.yml, locate the hc-install promote-production-packaging workflow, and approve.
1. Run the Release workflow with the appropriate version (matching the one in `version/VERSION`) & SHA (long one).
1. Wait for a message in the Slack channel saying that authorisation is needed to promote artifacts to production. Click on the link and approve.
1. Once notified that promotion is successful, go to https://github.com/hashicorp/crt-workflows-common/actions/workflows/promote-production-packaging.yml, locate the hc-install promote-production-packaging workflow, and approve.

0 comments on commit 9bbc98c

Please sign in to comment.