Skip to content

Commit 184d1f4

Browse files
authored
SWI-7144 Update Deploy Workflows (#171)
1 parent 07e70b6 commit 184d1f4

File tree

2 files changed

+91
-100
lines changed

2 files changed

+91
-100
lines changed
+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Deploy
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
branch:
6+
description: 'Branch to deploy from'
7+
required: true
8+
default: 'main'
9+
version:
10+
description: 'Version to deploy'
11+
required: true
12+
default: '1.0.0'
13+
14+
jobs:
15+
publish:
16+
env:
17+
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
18+
BW_USERNAME: ${{ secrets.BW_USERNAME }}
19+
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
20+
BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN }}
21+
BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN }}
22+
BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }}
23+
BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_MESSAGING_APPLICATION_ID }}
24+
BW_NUMBER: ${{ secrets.BW_NUMBER }}
25+
USER_NUMBER: ${{ secrets.USER_NUMBER }}
26+
VZW_NUMBER: ${{ secrets.VZW_NUMBER }}
27+
ATT_NUMBER: ${{ secrets.ATT_NUMBER }}
28+
T_MOBILE_NUMBER: ${{ secrets.T_MOBILE_NUMBER }}
29+
BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }}
30+
PYTHON_VERSION: ${{ matrix.python-version }}
31+
OPERATING_SYSTEM: ${{ matrix.os }}
32+
MANTECA_ACTIVE_NUMBER: ${{ secrets.MANTECA_ACTIVE_NUMBER }}
33+
MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_IDLE_NUMBER }}
34+
MANTECA_BASE_URL: ${{ secrets.MANTECA_BASE_URL }}
35+
MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }}
36+
BW_NUMBER_PROVIDER: ${{ secrets.BW_NUMBER_PROVIDER }}
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v4
40+
with:
41+
ref: ${{ github.event.inputs.branch }}
42+
43+
- name: Set up Apache Maven Central
44+
uses: actions/setup-java@v4
45+
with:
46+
distribution: 'adopt'
47+
java-version: 21
48+
server-id: 'ossrh'
49+
server-username: OSSRH_USERNAME
50+
server-password: OSSRH_PASSWORD
51+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
52+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
53+
54+
- name: Get Maven Project Version
55+
run: echo "RELEASE_VERSION=${{inputs.version}}" >> $GITHUB_ENV
56+
57+
- name: Set Maven Project Version
58+
run: mvn versions:set -DnewVersion=$RELEASE_VERSION
59+
60+
- name: Build Package and Test
61+
env:
62+
JAVA_VERSION: 21
63+
RUNNER_OS: ubuntu-latest
64+
OPERATING_SYSTEM: ubuntu -latest
65+
DISTRIBUTION: adopt
66+
run: |
67+
mvn -B package --file pom.xml -DskipTests
68+
npm install -g @stoplight/prism-cli
69+
prism mock ./bandwidth.yml & (sleep 3; mvn test -Punit-tests)
70+
shell: bash
71+
72+
- name: Publish to Apache Maven Central
73+
run: mvn deploy -DskipTests
74+
env:
75+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
76+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
77+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
78+
79+
- name: Notify Slack
80+
uses: Bandwidth/[email protected]
81+
if: always()
82+
with:
83+
job-status: ${{ job.status }}
84+
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
85+
slack-channel: ${{ secrets.SLACK_CHANNEL }}

.github/workflows/deploy.yml

+6-100
Original file line numberDiff line numberDiff line change
@@ -4,109 +4,9 @@ on:
44
types:
55
- published
66

7-
env:
8-
OPENAPI_GENERATOR_VERSION: 7.10.0
9-
107
jobs:
11-
deploy_pre_release:
12-
name: Deploy OpenAPI Generator Client Pre-Release to Maven
13-
if: ${{ github.event.release.prerelease && github.event.release.target_commitish == 'feature/openapi-generator-sdk' }}
14-
runs-on: ubuntu-latest
15-
env:
16-
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
17-
BW_USERNAME: ${{ secrets.BW_USERNAME }}
18-
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
19-
BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN }}
20-
BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN }}
21-
BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }}
22-
BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_MESSAGING_APPLICATION_ID }}
23-
BW_NUMBER: ${{ secrets.BW_NUMBER }}
24-
USER_NUMBER: ${{ secrets.USER_NUMBER }}
25-
VZW_NUMBER: ${{ secrets.VZW_NUMBER }}
26-
ATT_NUMBER: ${{ secrets.ATT_NUMBER }}
27-
T_MOBILE_NUMBER: ${{ secrets.T_MOBILE_NUMBER }}
28-
BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }}
29-
PYTHON_VERSION: ${{ matrix.python-version }}
30-
OPERATING_SYSTEM: ${{ matrix.os }}
31-
MANTECA_ACTIVE_NUMBER: ${{ secrets.MANTECA_ACTIVE_NUMBER }}
32-
MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_IDLE_NUMBER }}
33-
MANTECA_BASE_URL: ${{ secrets.MANTECA_BASE_URL }}
34-
MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }}
35-
BW_NUMBER_PROVIDER: ${{ secrets.BW_NUMBER_PROVIDER }}
36-
37-
steps:
38-
- name: Set Release Version
39-
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
40-
41-
- name: Check Release Tag Format
42-
run: |
43-
re=[0-9]+\.[0-9]+\.[0-9]+-beta\.[0-9]+
44-
if ! [[ $RELEASE_VERSION =~ $re ]]; then
45-
echo 'Tag does not match expected regex pattern for beta releases (v[0-9]+\.[0-9]+\.[0-9]+-beta\.[0-9]+)'
46-
echo $RELEASE_VERSION
47-
echo 'Please update your tag to match the expected regex pattern'
48-
exit 1
49-
fi
50-
51-
- name: Checkout
52-
uses: actions/checkout@v4
53-
with:
54-
ref: feature/openapi-generator-sdk
55-
56-
- name: Set up Apache Maven Central
57-
uses: actions/setup-java@v4
58-
with:
59-
distribution: 'adopt'
60-
java-version: 21
61-
server-id: ossrh
62-
server-username: MAVEN_USERNAME
63-
server-password: MAVEN_CENTRAL_TOKEN
64-
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
65-
gpg-passphrase: MAVEN_GPG_PASSPHRASE
66-
67-
- name: Build SDK
68-
uses: Bandwidth/[email protected]
69-
with:
70-
openapi-generator-version: ${{ env.OPENAPI_GENERATOR_VERSION }}
71-
language: java
72-
additional-properties: --additional-properties=artifactVersion=$RELEASE_VERSION
73-
74-
- name: Clean SDK
75-
run: mvn clean
76-
77-
- name: Set Maven Project Version
78-
run: mvn versions:set -DnewVersion=$RELEASE_VERSION
79-
80-
- name: Build Package and Test
81-
env:
82-
JAVA_VERSION: 21
83-
RUNNER_OS: ubuntu-latest
84-
OPERATING_SYSTEM: ubuntu -latest
85-
DISTRIBUTION: adopt
86-
run: |
87-
mvn -B package --file pom.xml -DskipTests
88-
npm install -g @stoplight/prism-cli
89-
prism mock ./bandwidth.yml & (sleep 3; mvn test -Punit-tests)
90-
shell: bash
91-
92-
- name: Publish to Apache Maven Central
93-
run: mvn deploy -DskipTests
94-
env:
95-
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
96-
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
97-
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
98-
99-
- uses: Bandwidth/[email protected]
100-
if: always()
101-
with:
102-
job-status: ${{ job.status }}
103-
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
104-
slack-channel: ${{ secrets.SLACK_CHANNEL }}
105-
1068
publish:
107-
if: ${{ !github.event.release.prerelease }}
1089
env:
109-
# Integration test environment variables.
11010
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
11111
BW_USERNAME: ${{ secrets.BW_USERNAME }}
11212
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
@@ -145,6 +45,12 @@ jobs:
14545
- name: Get Maven Project Version
14646
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
14747

48+
- name: Set OpenAPI Generator Version
49+
run: |
50+
OPENAPI_VERSION=$(jq .["generator-cli"].version openapitools.json)
51+
echo "OPENAPI_GENERATOR_VERSION=$OPENAPI_VERSION" >> $GITHUB_ENV
52+
shell: bash
53+
14854
- name: Build SDK
14955
uses: Bandwidth/[email protected]
15056
with:

0 commit comments

Comments
 (0)