-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up Publish action in Github Actions (#624)
- Loading branch information
1 parent
2c11fd4
commit ac7a267
Showing
6 changed files
with
84 additions
and
200 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: Publish packages | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
|
||
jobs: | ||
check-version: | ||
name: Check if version has changed | ||
runs-on: ubuntu-latest | ||
outputs: | ||
new_version: ${{ steps.check.outputs.new_version }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- id: check | ||
run: | | ||
currentVersion=$(grep '^version = ' build.gradle.kts | sed 's/version = //g' | tr -d '"') | ||
echo "Current version is $currentVersion" | ||
previousVersion=$(git show HEAD^:build.gradle.kts | grep '^version = ' | sed 's/version = //g' | tr -d '"') | ||
echo "Previous version is $previousVersion" | ||
if [ "$currentVersion" != "$previousVersion" ]; then | ||
echo "Version changed -- continuing workflow" | ||
echo "new_version=$currentVersion" >> "$GITHUB_OUTPUT" | ||
else | ||
echo "Version not changed -- aborting workflow" | ||
exit 1 | ||
fi | ||
create-tag: | ||
runs-on: ubuntu-latest | ||
needs: check-version | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: jaywcjlove/create-tag-action@v2 | ||
with: | ||
version: ${{ needs.check-version.outputs.new_version }} | ||
release: true | ||
test: '^v\d+\.\d+\.\d+$' | ||
|
||
publish-jvm: | ||
name: Publish JVM Package | ||
runs-on: ubuntu-latest | ||
needs: check-version | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'adopt' | ||
java-version: '17' | ||
- uses: gradle/actions/setup-gradle@v4 | ||
|
||
- name: Publish to Github Packages | ||
run: ./gradlew publishJvmPublicationToGitHubPackagesRepository | ||
|
||
publish-js: | ||
name: Publish JS Package | ||
runs-on: ubuntu-latest | ||
needs: check-version | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'adopt' | ||
java-version: '17' | ||
- uses: gradle/actions/setup-gradle@v4 | ||
|
||
- name: Publish to NPM | ||
run: | | ||
./gradlew assembleJsPackage | ||
cp "LICENSE" "build/packages/js/LICENSE" | ||
./gradlew publishJsPackageToNpmjsRegistry | ||
env: | ||
npm_token: ${{ secrets.NPM_TOKEN }} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.