Skip to content

Commit 116b937

Browse files
committed
Allow CI on any branch, skip CD on forks
1 parent f758d14 commit 116b937

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
name: CI/CD build
22

3-
on:
4-
workflow_dispatch:
5-
push:
6-
branches: [ "main" ]
3+
on: [push, pull_request, workflow_dispatch]
74

85
jobs:
96
build:
@@ -20,7 +17,12 @@ jobs:
2017
distribution: 'temurin'
2118
cache: 'maven'
2219

20+
- name: Build with Maven
21+
if: ${{ github.repository != 'spring-projects/spring-batch' || github.ref_name != 'main' }}
22+
run: mvn -s settings.xml --batch-mode --update-snapshots verify
23+
2324
- name: Build with Maven and deploy to Artifactory
25+
if: ${{ github.repository == 'spring-projects/spring-batch' && github.ref_name == 'main' }}
2426
env:
2527
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
2628
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
@@ -37,6 +39,7 @@ jobs:
3739
run: echo PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version --quiet -DforceStdout) >> $GITHUB_ENV
3840

3941
- name: Setup SSH key
42+
if: ${{ github.repository == 'spring-projects/spring-batch' && github.ref_name == 'main' }}
4043
env:
4144
DOCS_SSH_KEY: ${{ secrets.DOCS_SSH_KEY }}
4245
DOCS_SSH_HOST_KEY: ${{ secrets.DOCS_SSH_HOST_KEY }}
@@ -47,6 +50,7 @@ jobs:
4750
echo "$DOCS_SSH_HOST_KEY" > "$HOME/.ssh/known_hosts"
4851
4952
- name: Deploy Java docs
53+
if: ${{ github.repository == 'spring-projects/spring-batch' && github.ref_name == 'main' }}
5054
env:
5155
DOCS_HOST: ${{ secrets.DOCS_HOST }}
5256
DOCS_PATH: ${{ secrets.DOCS_PATH }}

0 commit comments

Comments
 (0)