Skip to content

Commit 9eabfce

Browse files
committed
Update permissions and create separate release pipeline from snapshot pipeline.
1 parent 9c1ca91 commit 9eabfce

File tree

4 files changed

+43
-5
lines changed

4 files changed

+43
-5
lines changed

.github/workflows/release-build.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
name: Build Rest Application Release
22

33
on:
4-
push:
5-
branches:
6-
- master
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
packages: write
79

810
jobs:
911
build:
@@ -20,7 +22,11 @@ jobs:
2022
distribution: 'temurin'
2123
architecture: x64
2224
- name: Publish artifacts
23-
run: ./gradlew publish -x check
25+
run: |
26+
NEW_VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3)
27+
echo "New version: ${NEW_VERSION}"
28+
echo "Github username: ${GITHUB_ACTOR}"
29+
./gradlew -Pversion=${NEW_VERSION} publish -x check
2430
env:
2531
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2632

.github/workflows/snapshot-build.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Build Snapshot
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
permissions:
9+
packages: write
10+
11+
jobs:
12+
build:
13+
uses: ./.github/workflows/component-build.yml
14+
release:
15+
runs-on: ubuntu-latest
16+
needs: build
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Configure Java version
20+
uses: actions/setup-java@v3
21+
with:
22+
java-version: '21'
23+
distribution: 'temurin'
24+
architecture: x64
25+
- name: Publish artifacts
26+
run: |
27+
echo "Github username: ${GITHUB_ACTOR}"
28+
./gradlew publish -x check
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,14 @@ subprojects {
3434
publications {
3535
create<MavenPublication>("maven") {
3636
groupId = "com.jongsoft.finance"
37-
version = "3.3.0-SNAPSHOT"
37+
version = System.getProperty("version")
3838
from(components["java"])
3939
}
4040
}
4141

4242
repositories {
4343
maven {
44+
name = "GitHubPackages"
4445
url = uri("https://maven.pkg.github.com/pledger-io/rest-application")
4546
credentials {
4647
username = System.getenv("GITHUB_ACTOR")

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
micronautVersion=4.3.4
2+
version=3.3.0-SNAPSHOT

0 commit comments

Comments
 (0)