-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
427 additions
and
4 deletions.
There are no files selected for viewing
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,133 @@ | ||
name: Build | ||
'on': | ||
pull_request: | ||
branches: | ||
- main | ||
- develop | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
- release/** | ||
permissions: | ||
contents: write | ||
jobs: | ||
version: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.gitversion.outputs.semVer }} | ||
versionCode: ${{ steps.run_number.outputs.versionCode }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install GitVersion | ||
uses: gittools/actions/gitversion/setup@v0.9.6 | ||
with: | ||
versionSpec: 5.x | ||
- id: gitversion | ||
name: Use GitVersion | ||
uses: gittools/actions/gitversion/execute@v0.9.6 | ||
with: | ||
useConfigFile: true | ||
configFilePath: ./gitversion.yml | ||
- name: Display SemVer | ||
run: 'echo "SemVer: ${{ steps.gitversion.outputs.semVer }}"' | ||
build: | ||
needs: | ||
- version | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: temurin | ||
- name: Build with Gradle | ||
env: | ||
ORG_GRADLE_PROJECT_version: ${{ needs.version.outputs.version }} | ||
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 | ||
with: | ||
arguments: build | ||
- name: Rename AAR | ||
run: mv ./build/libs/jlemmy-${{ needs.version.outputs.version }}.jar ./jlemmy.jar | ||
- uses: actions/upload-artifact@master | ||
with: | ||
name: jlemmy-jar | ||
path: ./jlemmy.jar | ||
release: | ||
permissions: | ||
contents: write | ||
needs: | ||
- version | ||
if: github.event_name != 'pull_request' | ||
runs-on: ubuntu-latest | ||
outputs: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- id: create_release | ||
name: Create Release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
tag_name: v${{ needs.version.outputs.version }} | ||
name: Release ${{ needs.version.outputs.version }} | ||
draft: false | ||
prerelease: ${{ github.ref != 'refs/heads/main' }} | ||
publish-release: | ||
needs: | ||
- version | ||
- release | ||
- build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/download-artifact@master | ||
with: | ||
name: jlemmy-jar | ||
path: ./ | ||
- name: Upload Artifact to Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
uses: actions/upload-release-asset@v1 | ||
with: | ||
upload_url: ${{ needs.release.outputs.upload_url }} | ||
asset_path: ./jlemmy.jar | ||
asset_name: jlemmy-v${{ needs.version.outputs.version }}.jar | ||
asset_content_type: application/zip | ||
publish-sonatype: | ||
permissions: | ||
contents: read | ||
needs: | ||
- version | ||
if: github.ref == 'refs/heads/main' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: temurin | ||
- name: Build with Gradle | ||
env: | ||
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} | ||
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} | ||
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.PGP_SECRET }} | ||
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PGP_PASSPHRASE }} | ||
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 | ||
with: | ||
arguments: |- | ||
-Pversion=${{ needs.version.outputs.version }} | ||
-Ppom.url="https://github.com/${{ github.repository }}" | ||
-Ppom.scm.connection="scm:git:git://github.com/${{ github.repository }}" | ||
-Ppom.scm.developerConnection="scm:git:ssh://github.com/${{ github.repository }}" | ||
-Ppom.scm.url="https://github.com/${{ github.repository }}" | ||
publishToCentralPortal --no-daemon |
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,27 @@ | ||
name: Test | ||
'on': | ||
pull_request: | ||
branches: | ||
- main | ||
- develop | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
- release/** | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: temurin | ||
- name: Test with Gradle | ||
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 | ||
with: | ||
arguments: test |
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,62 @@ | ||
extends "pkl/src/base.pkl" | ||
import "pkl/src/common.pkl" | ||
|
||
name = "Update" | ||
|
||
on = new On { | ||
schedule = new Schedule { | ||
cron = "* * * * Sun" | ||
} | ||
workflow_dispatch = new WorkflowDispatch {} | ||
} | ||
|
||
permissions = new Mapping { | ||
["contents"] = "write" | ||
} | ||
|
||
jobs = new Mapping { | ||
["update-types"] = new Job { | ||
steps = new Listing { | ||
common.checkout | ||
new CommandStep { | ||
name = "Update submodules" | ||
run = """ | ||
git pull --recurse-submodules | ||
git submodule update --remote --recursive type-generator/lemmy-js-client | ||
""" | ||
} | ||
new ActionStep { | ||
name = "Setup python" | ||
uses = "actions/setup-python@v3" | ||
with = new Mapping { | ||
["python-version"] = "3.11" | ||
} | ||
} | ||
new CommandStep { | ||
name = "Install dependencies" | ||
run = """ | ||
pip install -r requirements.txt | ||
""" | ||
} | ||
new CommandStep { | ||
name = "Build new types" | ||
run = """ | ||
python type-generator/main.py | ||
""" | ||
} | ||
new CommandStep { | ||
id = "date" | ||
name = "Get current date" | ||
run = "echo \"::set-output name=date::$(date +'%Y%m%d-%s')\"" | ||
} | ||
new ActionStep { | ||
name = "Create pull request" | ||
uses = "peter-evans/create-pull-request@v6" | ||
with = new Mapping { | ||
["branch"] = "update-types/feature/update-types-${{ steps.date.outputs.date }}" | ||
["name"] = "Update types from source" | ||
} | ||
} | ||
} | ||
} | ||
}.toMap().filter((k,v) -> v != null).toMapping() |
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,34 @@ | ||
name: Update | ||
'on': | ||
schedule: | ||
- cron: '* * * * Sun' | ||
workflow_dispatch: {} | ||
permissions: | ||
contents: write | ||
jobs: | ||
update-types: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Update submodules | ||
run: |- | ||
git pull --recurse-submodules | ||
git submodule update --remote --recursive type-generator/lemmy-js-client | ||
- name: Setup python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.11' | ||
- name: Install dependencies | ||
run: pip install -r requirements.txt | ||
- name: Build new types | ||
run: python type-generator/main.py | ||
- id: date | ||
name: Get current date | ||
run: echo "::set-output name=date::$(date +'%Y%m%d-%s')" | ||
- name: Create pull request | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
branch: update-types/feature/update-types-${{ steps.date.outputs.date }} | ||
name: Update types from source |
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,9 @@ | ||
amends "pkl/render.pkl" | ||
|
||
workflows = new Listing { | ||
(import("pkl/build.pkl")) { | ||
projectName = "jlemmy" | ||
} | ||
import("pkl/test.pkl") | ||
import("update-types.pkl") | ||
} |
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 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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[submodule "type-generator/lemmy-js-client"] | ||
path = type-generator/lemmy-js-client | ||
url = https://github.com/LemmyNet/lemmy-js-client.git | ||
[submodule ".github/workflows/pkl"] | ||
path = .github/workflows/pkl | ||
url = git@github.com:ComposeComponents/actions-java.git |
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 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 |
---|---|---|
@@ -1 +1,3 @@ | ||
# jlemmy | ||
|
||
A Java client for Lemmy |
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,2 @@ | ||
pkl eval -m .github/workflows .github/workflows/workflows.pkl | ||
pkl eval -f yaml -o gitversion.yml gitversion.pkl |
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 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 @@ | ||
amends "package://github.com/BenMMcLean/pkl-gitversion/releases/download/v0.1.1/pkl-gitversion@0.1.1#/default.pkl" |
Oops, something went wrong.