-
Notifications
You must be signed in to change notification settings - Fork 64
95 lines (83 loc) · 3.83 KB
/
automated-release.yml
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
# This workflow will release project with Gradle
name: Automated binary release
on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 0 * * 5'
workflow_dispatch:
inputs:
scope:
description: 'Specify scope that is to be used.'
required: true
type: choice
options:
- patch
- minor
- major
default: 'patch'
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.ZOWE_ROBOT_TOKEN }}
- uses: ./.github/actions/setup
- name: Build with Gradle
run: ./gradlew clean build
- name: Clean git
run: git reset --hard HEAD
- name: Set email
run: git config user.email "[email protected]"
- name: Set name
run: git config user.name "Zowe Robot"
- name: Release to NPM automatic
shell: bash
run: |
cd onboarding-enabler-nodejs
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
echo "registry=$DIST_REGISTRY" >> ~/.npmrc
npm version ${{ github.event.inputs.scope || env.DEFAULT_SCOPE }} --allow-same-version
npm publish --access public
git add package.json
git add package-lock.json
git commit -m "[skip ci] Update version"
git push
cd ..
env:
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
DEFAULT_SCOPE: 'patch'
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
DIST_REGISTRY: https://registry.npmjs.org/
- name: Release with Gradle automatic
shell: bash
run: |
./gradlew release -x test -x checkstyleTest -Prelease.useAutomaticVersion=true -Prelease.scope=${{ github.event.inputs.scope || env.DEFAULT_SCOPE }} -Pzowe.deploy.username=$ARTIFACTORY_USERNAME -Pzowe.deploy.password=$ARTIFACTORY_PASSWORD -Partifactory_user=$ARTIFACTORY_USERNAME -Partifactory_password=$ARTIFACTORY_PASSWORD
released_version=$(cat gradle.properties | grep "version=" | sed "s/version=//g")
sed -i "/REACT_APP_ZOWE_BUILD_INFO=/c\REACT_APP_ZOWE_BUILD_INFO=${released_version}" api-catalog-ui/frontend/.env
git add api-catalog-ui/frontend/.env
git commit -m "[skip ci] Update version"
git push
env:
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
DEFAULT_SCOPE: 'patch'
BUILD_NUMBER: ${{ github.run_number }}
BRANCH_NAME: ${{ github.ref_name }}
- name: Store test results
uses: actions/upload-artifact@v4
if: failure()
with:
name: ReleaseAutomated-${{ github.run_number }}
path: |
results/**
gateway-service/build/reports/**
discovery-service/build/reports/**
caching-service/build/reports/**
api-catalog-services/build/reports/**
zaas-service/build/reports/**
/home/runner/.npm/logs/**
- uses: ./.github/actions/teardown