Skip to content

Commit b7d0861

Browse files
fix: Github actions publish
1 parent a6b2932 commit b7d0861

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

.github/workflows/publish.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
name: Publish
22

33
on:
4-
push:
5-
tags:
6-
- 'v*'
4+
release:
5+
types: [created]
76

87
jobs:
98
publish:
109
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
packages: write
1113

1214
steps:
1315
- name: Checkout Code
@@ -23,9 +25,9 @@ jobs:
2325
id: extract_version
2426
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
2527

26-
- name: Publish package
27-
run: ./gradlew publish
28+
- name: Publish to GitHub Packages
29+
uses: gradle/gradle-build-action@v2
30+
with:
31+
arguments: publish
2832
env:
29-
USERNAME: ${{ github.actor }}
30-
TOKEN: ${{ secrets.GITHUB_TOKEN }}
31-
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ publishing {
3636
name = "GitHubPackages"
3737
url = uri("https://maven.pkg.github.com/o7studios/agones-java-sdk")
3838
credentials {
39-
username = project.findProperty("gpr.user") as String? ?: System.getenv("USERNAME")
40-
password = project.findProperty("gpr.key") as String? ?: System.getenv("TOKEN")
39+
username = System.getenv("GITHUB_ACTOR")
40+
password = System.getenv("GITHUB_TOKEN")
4141
}
4242
}
4343
}

0 commit comments

Comments
 (0)