Close release #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Close release | |
on: | |
workflow_dispatch: | |
inputs: | |
release_type: | |
description: 'Next version type' | |
required: true | |
type: choice | |
default: 'patch' | |
options: | |
- patch | |
- minor | |
- major | |
concurrency: | |
group: release | |
cancel-in-progress: false | |
jobs: | |
release: | |
name: Close release | |
runs-on: self-hosted-hoprnet-small | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: main # if you want to use a different branch keep in mind that the bump version step will be affected | |
token: '${{ secrets.GH_RUNNER_TOKEN }}' | |
- name: Setup Node.js | |
uses: hoprnet/hopr-workflows/actions/setup-node-js@master | |
with: | |
node-version: ${{ vars.NODE_VERSION }} | |
- name: Setup GCP | |
id: gcp | |
uses: hoprnet/hopr-workflows/actions/setup-gcp@master | |
with: | |
google-credentials: ${{ secrets.GOOGLE_HOPRASSOCIATION_CREDENTIALS_REGISTRY }} | |
login-artifact-registry: 'true' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver: kubernetes | |
- name: Building | |
run: yarn build | |
- name: Linting | |
run: yarn lint:ci | |
- name: Formatting | |
run: yarn format:ci | |
- name: Testing | |
run: yarn test | |
- name: Setup environment variables | |
id: environment | |
run: | | |
PACKAGE_VERSION="$(jq -r '.version' ./package.json)" | |
echo "release_version=${PACKAGE_VERSION}" >> $GITHUB_OUTPUT | |
- name: Create Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: '${{ vars.DOCKER_IMAGE_NAME }} - v${{ steps.environment.outputs.release_version }}' | |
tag_name: v${{ steps.environment.outputs.release_version }} | |
- name: Build and push docker image | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
tags: ${{ vars.DOCKER_IMAGE_REGISTRY }}/${{ vars.DOCKER_IMAGE_NAME }}:${{ steps.environment.outputs.release_version }} | |
- name: Bump Version | |
id: bump | |
run: | | |
npm version "${{ inputs.release_type }}" --no-git-tag-version | |
BUMP_VERSION=$(jq -r '.version' package.json) | |
echo "bump_version=${BUMP_VERSION}" >> $GITHUB_OUTPUT | |
- uses: EndBug/add-and-commit@v9 | |
with: | |
add: 'package.json' | |
new_branch: main | |
message: 'Bump to version ${{ steps.bump.outputs.bump_version }}' | |
pathspec_error_handling: exitImmediately | |
- name: Notify new release | |
uses: zulip/github-actions-zulip/send-message@v1 | |
with: | |
api-key: ${{ secrets.ZULIP_API_KEY }} | |
email: ${{ secrets.ZULIP_EMAIL }} | |
organization-url: 'https://hopr.zulipchat.com' | |
type: 'stream' | |
to: 'Releases' | |
topic: 'main' | |
content: | | |
I'm thrilled to inform the new **${{ vars.DOCKER_IMAGE_NAME }}** version **${{ steps.environment.outputs.release_version }}** has been released. |