Skip to content

Commit 132478a

Browse files
authored
Merge pull request #181 from OpenAPITools/ci-release-management
2 parents 00b62ff + c40bc2a commit 132478a

File tree

4 files changed

+89
-9
lines changed

4 files changed

+89
-9
lines changed

.github/workflows/maven.yml

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
name: Test
1+
name: Main Build
22
on:
33
push:
44
branches:
5-
- master
6-
pull_request:
7-
branches:
8-
- master
5+
- master
6+
paths-ignore:
7+
- 'docs/**'
8+
- '.circleci/**'
9+
- '.github/**'
910
jobs:
1011
build:
1112
runs-on: 'ubuntu-latest'
@@ -18,7 +19,7 @@ jobs:
1819
steps:
1920
- uses: actions/checkout@v2
2021
- name: Set up JDK
21-
uses: joschi/setup-[email protected]
22+
uses: actions/setup-java@v1
2223
with:
2324
java-version: ${{ matrix.java_version }}
2425
- uses: actions/[email protected]
@@ -27,7 +28,8 @@ jobs:
2728
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
2829
restore-keys: |
2930
${{ runner.os }}-maven-
30-
- name: Build with Maven
31-
run: ./mvnw -V -B -ntp -ff install '-DskipTests=true' '-Dmaven.javadoc.skip=true'
3231
- name: Run tests
3332
run: ./mvnw -V -B -ntp -ff verify
33+
- name: Release Snapshot
34+
if: matrix.java_version == '11'
35+
run: ./mvnw -V -B -ntp -ff deploy

.github/workflows/pr.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Pull Request Checks
2+
on:
3+
- pull_request
4+
5+
jobs:
6+
cleanup:
7+
name: Cleanup any previous jobs
8+
runs-on: ubuntu-latest
9+
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'"
10+
steps:
11+
- uses: rokroskar/[email protected]
12+
env:
13+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
14+
build:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
java_version: ['8', '11', '15']
20+
env:
21+
JAVA_OPTS: "-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
22+
steps:
23+
- uses: actions/checkout@v2
24+
- name: Set up JDK
25+
uses: actions/setup-java@v1
26+
with:
27+
java-version: ${{ matrix.java_version }}
28+
- uses: actions/[email protected]
29+
with:
30+
path: ~/.m2/repository
31+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
32+
restore-keys: |
33+
${{ runner.os }}-maven-
34+
- name: Run tests
35+
run: ./mvnw -V -B -ntp -ff verify

.github/workflows/release.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Triggered Release
2+
on: [workflow_dispatch]
3+
4+
env:
5+
OSS_USERNAME: ${{ secrets.OSS_USERNAME }}
6+
OSS_PASSWORD: ${{ secrets.OSS_PASSWORD }}
7+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
8+
9+
jobs:
10+
release:
11+
runs-on: ubuntu-latest
12+
if: github.ref == 'refs/heads/master'
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up JDK 11
16+
uses: actions/setup-java@v1
17+
with:
18+
java-version: 11
19+
# Value of the distributionManagement/repository/id field of the pom.xml
20+
server-id: sonatype-nexus-staging
21+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
22+
server-username: OSS_USERNAME
23+
server-password: OSS_PASSWORD
24+
gpg-passphrase: GPG_PASSPHRASE
25+
- uses: actions/[email protected]
26+
with:
27+
path: ~/.m2/repository
28+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
29+
restore-keys: |
30+
${{ runner.os }}-maven-
31+
- name: Setup Git
32+
run: |
33+
git config --global committer.email "[email protected]"
34+
git config --global committer.name "GitHub Release"
35+
git config --global author.email "${GITHUB_ACTOR}@users.noreply.github.com"
36+
git config --global author.name "${GITHUB_ACTOR}"
37+
- name: Release
38+
run: ./mvnw -B clean release:prepare release:perform -Prelease -Dgpg.passphrase=${{secrets.GPG_PASSPHRASE}} -Drepository.url=https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git
39+
- name: 'if failure -> rollback'
40+
if: ${{ failure() }}
41+
run: |
42+
./mvnw -B release:rollback -Prelease -Dgpg.passphrase=${{secrets.GPG_PASSPHRASE}}
43+
echo "You may need to manually delete the GitHub tag, if it was created."

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Compare two OpenAPI specifications (3.x) and render the difference to HTML plaintext, or Markdown files.
44

5-
[![Test](https://github.com/OpenAPITools/openapi-diff/workflows/Test/badge.svg)](https://github.com/OpenAPITools/openapi-diff/actions?query=branch%3Amaster+workflow%3ATest+)
5+
[![Build](https://github.com/OpenAPITools/openapi-diff/workflows/Main%20Build/badge.svg)](https://github.com/OpenAPITools/openapi-diff/actions?query=branch%3Amaster+workflow%3A"Main+Build")
66
[![Maven Central](https://img.shields.io/maven-central/v/org.openapitools.openapidiff/openapi-diff-core)](https://search.maven.org/artifact/org.openapitools.openapidiff/openapi-diff-core)
77
[![Join the Slack chat room](https://img.shields.io/badge/Slack-Join%20the%20chat%20room-orange)](https://join.slack.com/t/openapi-generator/shared_invite/enQtNzAyNDMyOTU0OTE1LTY5ZDBiNDI5NzI5ZjQ1Y2E5OWVjMjZkYzY1ZGM2MWQ4YWFjMzcyNDY5MGI4NjQxNDBiMTlmZTc5NjY2ZTQ5MGM)
88

0 commit comments

Comments
 (0)