-
Notifications
You must be signed in to change notification settings - Fork 13
84 lines (71 loc) · 3.04 KB
/
deploy.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
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support documentation
# This workflow will download a prebuilt Java version, install dependencies, build and deploy/publish a new release
name: Deploy and Publish
on:
workflow_run:
workflows: ["Build and Test"]
branches: [ master ]
types:
- completed
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
deploy:
if: "!contains(github.event.head_commit.message, 'skip ci')"
name: Deploy and Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
- name: Set up Java
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
- name: Build Spring boot package
run: |
echo -e "\nCommand: gradlew assemble"
./gradlew assemble
echo -e "\nCommand: gradlew check"
./gradlew check
echo -e "\nCommand: gradlew install -x check"
./gradlew install -x check
- name: Before Install
run: sed -i.bak -e 's|https://nexus.codehaus.org/snapshots/|https://oss.sonatype.org/content/repositories/codehaus-snapshots/|g' ~/.m2/settings.xml
- name: Install Semantic Release
run: |
sudo apt-get install bumpversion
npm install -g semantic-release
npm install -g @semantic-release/changelog
npm install -g @semantic-release/exec
npm install -g @semantic-release/git
npm install -g @semantic-release/github
npm install -g @semantic-release/commit-analyzer
npm install -g @semantic-release/release-notes-generator
- name: Check if semantic release generated a release
id: is_new_release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: echo ::set-output name=IS_NEW_RELEASE::$(npx semantic-release --dry-run | grep -c -i "Published release")
# Only run a real semantic release if the dry-run identified a new release
- name: Publish/Deploy to Maven Central
if: ${{ steps.is_new_release.outputs.IS_NEW_RELEASE == 1}}
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
run: scripts/deploy_gha.sh
- name: Publish to Git Releases and Tags
if: ${{ steps.is_new_release.outputs.IS_NEW_RELEASE == 1 }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: npx semantic-release # --dry-run --branches gha_9995
- name: SKIP - Publish/Deploy to Git and Maven Central
if: ${{ steps.is_new_release.outputs.IS_NEW_RELEASE == 0}}
run: |
echo -e "\n\033[0;35mCommand: Skipping the deployment because semantic release has determined there are no relevant changes that warrent a new release.\n"