-
Notifications
You must be signed in to change notification settings - Fork 7
103 lines (86 loc) · 3.03 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
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.