Skip to content

Commit 5b63a56

Browse files
authored
Merge pull request #2005 from microsoftgraph/fix/mvn-release-on-tags
Trigger maven releases on tag creation
2 parents 84b3676 + 1a87cfd commit 5b63a56

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

.github/workflows/preview-and-release.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,28 @@ name: Maven Preview/Release and Github Release
22

33
on:
44
push:
5-
branches: [dev, support/5.x.x]
5+
branches: [dev]
66
paths-ignore:
77
- '.gradle/wrapper'
88
- '.gitignore'
99
- 'LICENSE'
1010
- 'THIRD PARTY NOTICES'
1111
- '*.md'
12-
workflow_dispatch:
12+
tags:
13+
- "v[0-9]+.[0-9]+.[0-9]+"
14+
workflow_dispatch:
1315

14-
env:
16+
env:
1517
PREVIEW_TASK: publishSnapshotPublicationToSonatypeSnapshotRepository
1618
PUBLISH_TASK: publishMavenCentralReleasePublicationToSonatypeRepository
1719

1820
jobs:
1921
maven_Preview:
2022
if: ${{ github.ref == 'refs/heads/dev' }}
21-
environment:
23+
environment:
2224
name: maven_central_snapshot
2325
runs-on: ubuntu-latest
24-
steps:
26+
steps:
2527
- uses: actions/checkout@v4
2628
- name: Set up JDK
2729
uses: actions/setup-java@v4
@@ -34,7 +36,7 @@ jobs:
3436
- name: Download File
3537
run: .\Scripts\decodeAndWrite.ps1 -encodedValue $env:ENCODED_VALUE -outputPath $env:OUTPUT_PATH
3638
shell: pwsh
37-
env:
39+
env:
3840
ENCODED_VALUE: ${{ secrets.LOCAL_PROPERTIES }}
3941
OUTPUT_PATH: '.\local.properties'
4042
- name: Download File
@@ -47,9 +49,9 @@ jobs:
4749
run: chmod +x gradlew
4850
- name: Publish
4951
run: ./gradlew $PREVIEW_TASK
50-
52+
5153
maven_Release:
52-
if: ${{ github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/support/5.x.x' }}
54+
if: startsWith(github.ref, 'refs/tags/')
5355
environment:
5456
name: maven_central_release
5557
runs-on: ubuntu-latest
@@ -66,13 +68,13 @@ jobs:
6668
- name: Download File
6769
run: .\Scripts\decodeAndWrite.ps1 -encodedValue $env:ENCODED_VALUE -outputPath $env:OUTPUT_PATH
6870
shell: pwsh
69-
env:
71+
env:
7072
ENCODED_VALUE: ${{ secrets.LOCAL_PROPERTIES }}
71-
OUTPUT_PATH: '.\local.properties'
73+
OUTPUT_PATH: '.\local.properties'
7274
- name: Download File
73-
run: .\Scripts\decodeAndWrite.ps1 -encodedValue $env:ENCODED_VALUE -outputPath $env:OUTPUT_PATH
75+
run: .\Scripts\decodeAndWrite.ps1 -encodedValue $env:ENCODED_VALUE -outputPath $env:OUTPUT_PATH
7476
shell: pwsh
75-
env:
77+
env:
7678
ENCODED_VALUE: ${{ secrets.SECRING_GPG }}
7779
OUTPUT_PATH: '.\secring.gpg'
7880
- name: Grant execute permission for gradlew

0 commit comments

Comments
 (0)