Skip to content

Commit 1fe9322

Browse files
authored
feat(release): use publish-on-central 2.x.x (#224)
1 parent f6c65a8 commit 1fe9322

3 files changed

Lines changed: 61 additions & 26 deletions

File tree

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,47 @@
1-
name: CI
1+
name: CI/CD Process
22
on:
3-
push:
4-
tags: '*'
5-
branches-ignore:
6-
- 'autodelivery**'
7-
- 'bump-**'
8-
- 'renovate/**'
9-
- 'dependabot/**'
10-
paths-ignore:
11-
- 'CHANGELOG.md'
12-
- 'renovate.json'
13-
- '.gitignore'
14-
pull_request:
3+
workflow_call:
154
workflow_dispatch:
165

176
jobs:
187
build:
198
strategy:
209
matrix:
21-
os: [ windows, macos, ubuntu ]
10+
os: [windows, macos, ubuntu]
2211
runs-on: ${{ matrix.os }}-latest
23-
timeout-minutes: 60
2412
steps:
2513
- name: Checkout
26-
uses: danysk/action-checkout@0.2.1
14+
uses: DanySK/action-checkout@0.2.1
2715
- uses: DanySK/build-check-deploy-gradle-action@2.1.0
2816
with:
29-
deploy-command: |
30-
./gradlew closeJavaMavenOnMavenCentralNexus --parallel
31-
should-run-codecov: ${{ contains('Linux', runner.os) }}
17+
deploy-command: >-
18+
./gradlew uploadJava close --parallel
19+
|| ./gradlew uploadJava close --parallel
20+
|| ./gradlew uploadJava close --parallel
21+
should-run-codecov: ${{ runner.os == 'Linux' }}
3222
should-deploy: >-
3323
${{
34-
contains('Linux', runner.os)
35-
&& contains(github.repository, 'DanySK/java-quadtree')
36-
&& contains('push workflow_dispatch', github.event_name)
24+
runner.os == 'Linux'
25+
&& !github.event.repository.fork
26+
&& (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
3727
}}
3828
maven-central-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
3929
signing-key: ${{ secrets.SIGNING_KEY }}
4030
signing-password: ${{ secrets.SIGNING_PASSWORD }}
41-
Release:
31+
release:
4232
needs:
4333
- build
4434
runs-on: ubuntu-latest
4535
if: >-
46-
contains('push workflow_dispatch', github.event_name)
47-
&& contains(github.repository, 'DanySK/java-quadtree')
36+
!github.event.repository.fork
37+
&& (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
38+
concurrency:
39+
group: release
4840
steps:
4941
- name: Checkout
5042
uses: actions/checkout@v3.0.2
43+
with:
44+
token: ${{ secrets.DEPLOYMENT_TOKEN }}
5145
- uses: DanySK/build-check-deploy-gradle-action@2.1.0
5246
with:
5347
build-command: true
@@ -62,3 +56,16 @@ jobs:
6256
maven-central-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
6357
signing-key: ${{ secrets.SIGNING_KEY }}
6458
signing-password: ${{ secrets.SIGNING_PASSWORD }}
59+
success:
60+
runs-on: ubuntu-latest
61+
needs:
62+
- build
63+
- release
64+
if: >-
65+
always() && (
66+
contains(join(needs.*.result, ','), 'failure')
67+
|| !contains(join(needs.*.result, ','), 'cancelled')
68+
)
69+
steps:
70+
- name: Verify that the workflow executed and there were no failures
71+
run: ${{ !contains(join(needs.*.result, ','), 'failure') }}

.github/workflows/dispatcher.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: CI/CD
2+
on:
3+
push:
4+
branches-ignore:
5+
- 'dependabot/**'
6+
paths-ignore:
7+
- '.gitignore'
8+
- 'CHANGELOG.md'
9+
- 'LICENSE'
10+
- 'README.md'
11+
- 'renovate.json'
12+
pull_request:
13+
workflow_dispatch:
14+
15+
jobs:
16+
dispatcher:
17+
runs-on: ubuntu-latest
18+
if: >-
19+
github.event_name != 'pull_request'
20+
|| github.event.pull_request.head.repo.full_name != github.repository
21+
|| startsWith(github.head_ref, 'refs/heads/dependabot/')
22+
steps:
23+
- run: 'true'
24+
ci-cd:
25+
needs:
26+
- dispatcher
27+
uses: ./.github/workflows/build-and-deploy.yml
28+
secrets: inherit

release.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var publishCmd = `
22
git tag -a -f \${nextRelease.version} \${nextRelease.version} -F CHANGELOG.md
3+
./gradlew uploadJava release --parallel || ./gradlew uploadJava release --parallel || ./gradlew uploadJava release --parallel || exit 1
34
git push --force origin \${nextRelease.version}
4-
./gradlew releaseJavaMavenOnMavenCentralNexus --parallel || exit 1
55
`
66
var config = require('semantic-release-preconfigured-conventional-commits');
77
config.plugins.push(

0 commit comments

Comments
 (0)