-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: merge generators repo into core (#201)
- Loading branch information
Showing
58 changed files
with
3,398 additions
and
3 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
.github/workflows/github-release-actions.yml → .github/workflows/core-release.yml
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,4 +1,4 @@ | ||
name: Release | ||
name: Release Core | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
|
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,38 @@ | ||
name: Generate SDK - Generate | ||
on: | ||
workflow_call: | ||
inputs: | ||
version: | ||
description: 'generated sdk version' | ||
required: true | ||
type: string | ||
name: | ||
description: 'generated sdk name' | ||
required: true | ||
type: string | ||
fileAsBase64: | ||
description: 'generated sdk file as base64 encoded' | ||
required: true | ||
type: string | ||
jobs: | ||
generate: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
- id: build | ||
working-directory: generator | ||
run: mvn clean install | ||
- name: generate | ||
working-directory: generator/openapi | ||
run: | | ||
mvn clean install | ||
mvn exec:java "-Dnamespace=${{ inputs.name }}" -DsdkVersion=${{ inputs.version }} "-Dspec=${{ inputs.fileAsBase64 }}" | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: sdk | ||
path: generator/openapi/target/sdk |
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,36 @@ | ||
name: Generate SDK - Main | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Generated SDK version' | ||
required: false | ||
default: '' | ||
name: | ||
description: 'Generated SDK name' | ||
required: true | ||
fileAsBase64: | ||
description: 'Generated SDK file as base64 encoded' | ||
required: true | ||
test: | ||
description: 'Release snapshot?' | ||
required: false | ||
jobs: | ||
prepare_version: | ||
uses: ./.github/workflows/generator-prepare-version.yml | ||
with: | ||
version: ${{ github.event.inputs.version }} | ||
name: ${{ github.event.inputs.name }} | ||
generate: | ||
needs: [ prepare_version ] | ||
uses: ./.github/workflows/generator-generate.yml | ||
with: | ||
version: ${{ needs.prepare_version.outputs.version }} | ||
name: ${{ github.event.inputs.name }} | ||
fileAsBase64: ${{ github.event.inputs.fileAsBase64 }} | ||
publish: | ||
needs: [ generate ] | ||
uses: ./.github/workflows/generator-publish.yml | ||
secrets: inherit | ||
with: | ||
test: ${{ github.event.inputs.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,36 @@ | ||
name: Generate SDK - Prepare Version | ||
on: | ||
workflow_call: | ||
inputs: | ||
version: | ||
required: true | ||
type: string | ||
name: | ||
required: true | ||
type: string | ||
outputs: | ||
version: | ||
value: ${{ jobs.prepare_version.outputs.version }} | ||
jobs: | ||
prepare_version: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.prepare_version.outputs.version }} | ||
steps: | ||
- id: prepare_version | ||
run: | | ||
if [ -z "${{ github.event.inputs.version }}" ]; then | ||
sudo apt-get update | ||
sudo apt-get -y install libxml2-utils | ||
CURRENT_VERSION=$(curl --silent https://repo1.maven.org/maven2/com/expediagroup/openworld/sdk/openworld-java-sdk-${{ github.event.inputs.name }}/maven-metadata.xml | xmllint --xpath "/metadata/versioning/latest/text()" -) || CURRENT_VERSION=0.1.0 | ||
LAST_CHARACTER=${CURRENT_VERSION: -1} | ||
REGEX='^[0-9]+$' | ||
if ! [[ $LAST_CHARACTER =~ $REGEX ]]; then | ||
CURRENT_VERSION="${CURRENT_VERSION}.1" | ||
else | ||
CURRENT_VERSION="${CURRENT_VERSION%?}$((LAST_CHARACTER+1))" | ||
fi | ||
echo "version=${CURRENT_VERSION}" >> $GITHUB_OUTPUT | ||
else | ||
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT | ||
fi |
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,45 @@ | ||
name: Generate SDK - Publish | ||
on: | ||
workflow_call: | ||
inputs: | ||
test: | ||
description: 'Release snapshot?' | ||
type: string | ||
required: false | ||
jobs: | ||
job: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.publish.outputs.version }} | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: sdk | ||
path: generator/sdk | ||
- name: "JDK set-up" | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
server-id: oss-sonatype # Value of the distributionManagement/repository/id field of the pom.xml | ||
server-username: SONATYPE_USERNAME # env variable for username in deploy | ||
server-password: SONATYPE_PASSWORD # env variable for token in deploy | ||
# only signed artifacts will be released to maven central. this sets up things for the maven-gpg-plugin | ||
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import | ||
gpg-passphrase: GPG_PASSPHRASE # env variable for GPG private key passphrase | ||
settings-path: ${{ github.workspace }} | ||
- name: "Release artifacts" | ||
env: | ||
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | ||
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | ||
GPG_PASSPHRASE: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }} | ||
run: | | ||
cd generator/sdk | ||
if [ -z "${{ github.event.inputs.test }}" ]; then | ||
mvn deploy --settings $GITHUB_WORKSPACE/settings.xml -B -U -P release -DskipTests=true | ||
else | ||
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | ||
SNAPSHOT_VERSION="${VERSION%-SNAPSHOT}-SNAPSHOT" | ||
mvn deploy --settings $GITHUB_WORKSPACE/settings.xml -B -U -P release -DskipTests=true -Drevision=$SNAPSHOT_VERSION | ||
fi | ||
echo "version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT |
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,46 @@ | ||
name: Verify generated SDK | ||
on: | ||
pull_request: | ||
branches: | ||
- 'main' | ||
concurrency: | ||
group: ${{ github.head_ref }} | ||
cancel-in-progress: true | ||
jobs: | ||
generate-sdk: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
- id: build-with-maven | ||
working-directory: generator | ||
run: mvn clean install -P github-generate-action-profile | ||
- name: Generate SDK Files | ||
working-directory: generator/openapi | ||
run: | | ||
mvn clean install | ||
mvn exec:java "-Dnamespace=exemplar" "-DsdkVersion=0.0.1-exemplar" "-Dspec=${{ secrets.SPEC_FILE }}" | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: sdk | ||
path: generator/openapi/target/sdk | ||
verify-generated-sdk: | ||
runs-on: ubuntu-latest | ||
needs: generate-sdk | ||
steps: | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: sdk | ||
path: generator/sdk | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
- name: verify generated sdk | ||
working-directory: generator/sdk | ||
run: mvn verify |
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,6 @@ | ||
# Open World SDK Generator Change Log | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
### [0.0.1] 2022.08.xx | ||
* Initial release |
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,16 @@ | ||
# How to Contribute | ||
|
||
We'd love to accept your patches and contributions to this project. | ||
|
||
## Fork this repo | ||
|
||
You should create a fork of this project in your account and work from there. You can create a fork by clicking the fork button in GitHub. | ||
|
||
## Merging your contribution | ||
|
||
Create a new pull request and your code will be reviewed by the maintainers. They will confirm at least the following: | ||
|
||
- Tests run successfully | ||
- Documentation added for new or updated functionality | ||
|
||
A maintainer will need to sign off on your pull request before it can be merged. |
Oops, something went wrong.