fix pom #63
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
name: Generate SDKs | |
on: | |
push: | |
branches: ["main"] | |
workflow_dispatch: | |
jobs: | |
generate-js-client: | |
runs-on: ubuntu-latest | |
name: Generate js sdk | |
steps: | |
- name: Checkout OpenAPI | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Generate JS sdk | |
uses: openapi-generators/openapitools-generator-action@v1 | |
with: | |
generator: javascript | |
openapi-file: openapi-3.0.yaml | |
command-args: --additional-properties=moduleName=dofusdude,projectName=dofusdude-js,licenseName=MIT | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3.4.1 | |
with: | |
node-version: 16.x | |
- name: Generate package-lock.json | |
run: | | |
cp -r javascript-client javascript-client-cp | |
cd javascript-client-cp | |
npm i | |
cp package-lock.json ../javascript-client/package-lock.json | |
cd ../javascript-client | |
mkdir -p .github/workflows/ | |
printf '%s\n' 'name: Node.js CI' 'on:' ' push:' ' branches: [ "main" ]' ' pull_request:' ' branches: [ "main" ]' 'jobs:' ' build:' ' runs-on: ubuntu-latest' ' strategy:' ' matrix:' ' node-version: [14.x, 16.x, 18.x]' ' steps:' ' - uses: actions/checkout@v3' ' - name: Use Node.js ${{ matrix.node-version }}' ' uses: actions/setup-node@v3' ' with:' ' node-version: ${{ matrix.node-version }}' ' cache: npm' ' - run: npm ci' ' - run: npm run build --if-present' ' - run: npm test' '' > .github/workflows/testing.yml | |
printf '%s\n' 'name: Node.js Package' 'on:' ' release:' ' types: [created]' 'jobs:' ' build:' ' runs-on: ubuntu-latest' ' steps:' ' - uses: actions/checkout@v3' ' - uses: actions/setup-node@v3' ' with:' ' node-version: 16' ' - run: npm ci' ' - run: npm test' ' publish-npm:' ' needs: build' ' runs-on: ubuntu-latest' ' steps:' ' - uses: actions/checkout@v3' ' - uses: actions/setup-node@v3' ' with:' ' node-version: 16' ' registry-url: https://registry.npmjs.org/' ' - run: npm ci' ' - run: npm publish' ' env:' ' NODE_AUTH_TOKEN: secrets.NPM_TOKEN' > .github/workflows/publish.yml | |
sed -i 's/secrets.NPM_TOKEN/\$\{\{secrets.NPM_TOKEN\}\}/g' .github/workflows/publish.yml | |
sed -i 's/\\"/"/g' README.md | |
cd .. | |
- name: Pushes to another repository | |
uses: cpina/github-action-push-to-another-repository@main | |
env: | |
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} | |
API_TOKEN_GITHUB: ${{ secrets.PUSH_GITHUB_TOKEN }} | |
with: | |
source-directory: "javascript-client" | |
destination-github-username: "dofusdude" | |
destination-repository-name: "dofusdude-js" | |
user-email: stelzo@steado.de | |
target-branch: main | |
generate-ts-client: | |
runs-on: ubuntu-latest | |
name: Generate ts sdk | |
steps: | |
- name: Checkout OpenAPI | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Generate TS sdk | |
uses: openapi-generators/openapitools-generator-action@v1 | |
with: | |
generator: typescript-axios | |
openapi-file: openapi-3.0.yaml | |
command-args: --additional-properties=npmName=dofusdude-ts | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3.4.1 | |
with: | |
node-version: 16.x | |
- name: Generate package-lock.json | |
run: | | |
cp -r typescript-axios-client typescript-axios-client-cp | |
cd typescript-axios-client-cp | |
npm i | |
cp package-lock.json ../typescript-axios-client/package-lock.json | |
cd ../typescript-axios-client | |
mkdir -p .github/workflows/ | |
printf '%s\n' 'name: Node.js CI' 'on:' ' push:' ' branches: [ "main" ]' ' pull_request:' ' branches: [ "main" ]' 'jobs:' ' build:' ' runs-on: ubuntu-latest' ' strategy:' ' matrix:' ' node-version: [14.x, 16.x, 18.x]' ' steps:' ' - uses: actions/checkout@v3' ' - name: Use Node.js ${{ matrix.node-version }}' ' uses: actions/setup-node@v3' ' with:' ' node-version: ${{ matrix.node-version }}' ' cache: npm' ' - run: npm ci' ' - run: npm run build --if-present' '' > .github/workflows/build.yml | |
printf '%s\n' 'name: Node.js Package' 'on:' ' release:' ' types: [created]' 'jobs:' ' build:' ' runs-on: ubuntu-latest' ' steps:' ' - uses: actions/checkout@v3' ' - uses: actions/setup-node@v3' ' with:' ' node-version: 16' ' - run: npm ci' ' publish-npm:' ' needs: build' ' runs-on: ubuntu-latest' ' steps:' ' - uses: actions/checkout@v3' ' - uses: actions/setup-node@v3' ' with:' ' node-version: 16' ' registry-url: https://registry.npmjs.org/' ' - run: npm ci' ' - run: npm publish' ' env:' ' NODE_AUTH_TOKEN: secrets.NPM_TOKEN' > .github/workflows/publish.yml | |
sed -i 's/secrets.NPM_TOKEN/\$\{\{secrets.NPM_TOKEN\}\}/g' .github/workflows/publish.yml | |
sed -i 's/\\"/"/g' README.md | |
cd .. | |
- name: Pushes to another repository | |
uses: cpina/github-action-push-to-another-repository@main | |
env: | |
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY_TS }} | |
API_TOKEN_GITHUB: ${{ secrets.PUSH_GITHUB_TOKEN }} | |
with: | |
source-directory: "typescript-axios-client" | |
destination-github-username: "dofusdude" | |
destination-repository-name: "dofusdude-ts" | |
user-email: stelzo@steado.de | |
target-branch: main | |
generate-java-client: | |
runs-on: ubuntu-latest | |
name: Generate java sdk | |
steps: | |
- name: Checkout OpenAPI | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Generate java sdk | |
uses: openapi-generators/openapitools-generator-action@v1 | |
with: | |
generator: java | |
openapi-file: openapi-3.0.yaml | |
command-args: --additional-properties=apiPackage=com.dofusdude.client.api,artifactDescription=dofusdude-client,artifactId=dofusdude-java,artifactUrl=https://github.com/dofusdude/dofusdude-java,developerEmail=stelzo@steado.de,developerName=stelzo,developerOrganization=dofusdude,developerOrganizationUrl=https://github.com/dofusdude,library=microprofile,invokerPackage=com.dofusdude.client,modelPackage=com.dofusdude.client.model,groupId=com.dofusdude,useJakartaEe=true | |
- name: Add actions and patch pom.xml | |
run: | | |
cd java-client | |
mkdir -p .github/workflows/ | |
printf '%s\n' 'name: Go' 'on:' ' push:' ' branches: [ main ]' ' pull_request:' ' branches: [ main ]' 'jobs:' ' build:' ' runs-on: ubuntu-latest' ' steps:' ' - uses: actions/checkout@v3' ' - name: Set up Java' ' uses: actions/setup-java@v4' ' with:' ' java-version: "17"' ' distribution: "temurin"' ' - name: Verify and test' ' run: mvn --batch-mode --update-snapshots verify && mvn test' > .github/workflows/build.yml | |
printf '%s\n' 'name: Upload Java Maven Package' 'on:' ' release:' ' types: [created]' 'permissions:' ' contents: read' ' packages: write' 'jobs:' ' deploy:' ' runs-on: ubuntu-latest' ' steps:' ' - uses: actions/checkout@v4' ' - name: Set up Java' ' uses: actions/setup-java@v4' ' with:' ' java-version: "17"' ' distribution: "temurin"' ' server-id: central' ' server-username: MAVEN_USERNAME' ' server-password: MAVEN_PASSWORD' ' - name: Create Key File' ' run: echo "$GPG_PRIVATE_KEY" > private.key' ' env: ' ' GPG_PRIVATE_KEY: secrets.GPG_PRIVATE' ' run: gpg --import --batch private.key' ' - name: Import GPG Key' ' - name: Publish package' ' run: mvn --batch-mode deploy' ' env:' ' MAVEN_USERNAME: secrets.OSSRH_USERNAME' ' MAVEN_PASSWORD: secrets.OSSRH_TOKEN' ' GPG_KEYNAME: secrets.GPG_KEYNAME' > .github/workflows/publish.yml | |
sed -i 's/secrets.OSSRH_TOKEN/\$\{\{secrets.OSSRH_TOKEN\}\}/g' .github/workflows/publish.yml | |
sed -i 's/secrets.OSSRH_USERNAME/\$\{\{secrets.OSSRH_USERNAME\}\}/g' .github/workflows/publish.yml | |
sed -i 's/secrets.GPG_KEYNAME/\$\{\{secrets.GPG_KEYNAME\}\}/g' .github/workflows/publish.yml | |
sed -i 's/secrets.GPG_PRIVATE/\$\{\{secrets.GPG_PRIVATE\}\}/g' .github/workflows/publish.yml | |
sed -i 's|</description>|</description><url>https://github.com/dofusdude/dofusdude-java</url>|g' pom.xml | |
sed -i 's|<build>|<scm><connection>scm:git:git@github.com:dofusdude/dofusdude-java.git</connection><developerConnection>scm:git:git@github.com:dofusdude/dofusdude-java.git</developerConnection><url>https://github.com/dofusdude/dofusdude-java/tree/main</url></scm><licenses><license><name>GNU General Public License 3</name><url>https://www.gnu.org/licenses/gpl-3.0.txt</url><distribution>repo</distribution></license></licenses><developers><developer><id>stelzo</id><name>Christopher Sieh</name><url>https://github.com/stelzo</url><roles><role>developer</role></roles></developer></developers><build>|g' pom.xml | |
sed -i 's|</plugins>|<plugin><groupId>org.sonatype.central</groupId><artifactId>central-publishing-maven-plugin</artifactId><version>0.4.0</version><extensions>true</extensions><configuration><publishingServerId>central</publishingServerId><autoPublish>true</autoPublish><tokenAuth>true</tokenAuth></configuration></plugin></plugins>|g' pom.xml | |
sed -i 's|</plugins>|<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-javadoc-plugin</artifactId><version>3.6.3</version><executions><execution><id>attach-javadocs</id><goals><goal>jar</goal></goals></execution></executions></plugin></plugins>|g' pom.xml | |
sed -i 's|</plugins>|<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-source-plugin</artifactId><version>3.3.0</version><executions><execution><id>attach-sources</id><goals><goal>jar</goal></goals></execution></executions></plugin></plugins>|g' pom.xml | |
sed -i 's|</plugins>|<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-gpg-plugin</artifactId><version>3.2.2</version><executions><execution><id>sign-artifacts</id><phase>verify</phase><goals><goal>sign</goal></goals><configuration><gpgArguments><arg>--pinentry-mode</arg><arg>loopback</arg></gpgArguments></configuration></execution></executions></plugin></plugins>|g' pom.xml | |
sed -i 's|</dependencies>| <dependency><groupId>org.openapitools</groupId><artifactId>jackson-databind-nullable</artifactId><version>0.2.6</version></dependency></dependencies>|g' pom.xml | |
sed -i 's|</project>| <distributionManagement><repository><id>central</id><name>Central Repository Central</name><url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url></repository></distributionManagement></project>|g' pom.xml | |
sed -i 's/\\"/"/g' README.md | |
cd .. | |
- name: Pushes to sdk repository | |
uses: cpina/github-action-push-to-another-repository@main | |
env: | |
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY_JAVA }} | |
API_TOKEN_GITHUB: ${{ secrets.PUSH_GITHUB_TOKEN }} | |
with: | |
source-directory: "java-client" | |
destination-github-username: "dofusdude" | |
destination-repository-name: "dofusdude-java" | |
user-email: stelzo@steado.de | |
target-branch: main | |
generate-go-client: | |
runs-on: ubuntu-latest | |
name: Generate go sdk | |
steps: | |
- name: Checkout OpenAPI | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Generate go sdk | |
uses: openapi-generators/openapitools-generator-action@v1 | |
with: | |
generator: go | |
openapi-file: openapi-3.0.yaml | |
command-args: --additional-properties=packageName=dodugo | |
- name: Setup Go environment | |
uses: actions/setup-go@v3.3.0 | |
with: | |
check-latest: true | |
go-version-file: go-client/go.mod | |
cache-dependency-path: go-client/go.sum | |
- name: Add actions | |
run: | | |
cd go-client | |
mkdir -p .github/workflows/ | |
printf '%s\n' 'name: Go' 'on:' ' push:' ' branches: [ main ]' ' pull_request:' ' branches: [ main ]' 'jobs:' ' build:' ' runs-on: ubuntu-latest' ' steps:' ' - uses: actions/checkout@v3' ' - name: Set up Go' ' uses: actions/setup-go@v2' ' with:' ' go-version: 1.19' ' - name: Build' ' run: go build -v ./...' > .github/workflows/build.yml | |
grep -rl GIT_USER_ID . | xargs sed -i 's/GIT_USER_ID\/GIT_REPO_ID/\dofusdude\/dodugo/g' | |
sed -i 's/\\"/"/g' README.md | |
go get -u ./... | |
go mod tidy | |
printf '%s\n' '* linguist-vendored' '*.go linguist-vendored=false' > .gitattributes | |
cd .. | |
- name: Pushes to sdk repository | |
uses: cpina/github-action-push-to-another-repository@main | |
env: | |
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY_GO }} | |
API_TOKEN_GITHUB: ${{ secrets.PUSH_GITHUB_TOKEN }} | |
with: | |
source-directory: "go-client" | |
destination-github-username: "dofusdude" | |
destination-repository-name: "dodugo" | |
user-email: stelzo@steado.de | |
target-branch: main | |
generate-python-client: | |
runs-on: ubuntu-latest | |
name: Generate python sdk | |
steps: | |
- name: Checkout OpenAPI | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: OpenAPI API Version Print | |
uses: stelzo/openapi-api-version-print@v1 | |
id: api-version-print | |
with: | |
specFile: openapi-3.0.yaml | |
- name: Generate python sdk | |
uses: openapi-generators/openapitools-generator-action@v1 | |
with: | |
generator: python | |
openapi-file: openapi-3.0.yaml | |
command-args: --additional-properties=packageName=dofusdude,projectName=dofusdude,packageUrl=https://github.com/dofusdude/dofusdude-py,packageVersion=${{steps.api-version-print.outputs.apiVersion}} | |
- name: Setup Python environment | |
uses: actions/setup-python@v4.2.0 | |
with: | |
python-version: 3.8 | |
- name: Add actions | |
run: | | |
cd python-client | |
mkdir -p .github/workflows/ | |
printf '%s\n' 'name: Upload Python Package' 'on:' ' release:' ' types: [published]' 'permissions:' ' contents: read' 'jobs:' ' deploy:' ' runs-on: ubuntu-latest' ' steps:' ' - uses: actions/checkout@v3' ' - name: Set up Python' ' uses: actions/setup-python@v3' ' with:' ' python-version: 3.8' ' - name: Install dependencies' ' run: |' ' python -m pip install --upgrade pip' ' pip install build' ' - name: Build package' ' run: python -m build' ' - name: Publish package' ' uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29' ' with:' ' user: __token__' ' password: secrets.PYPI_API_TOKEN' > .github/workflows/publish.yml | |
sed -i 's/GIT_USER_ID\/GIT_REPO_ID/\dofusdude\/dofusdude-py/g' README.md | |
sed -i 's/\\"/"/g' README.md | |
sed -i 's/secrets.PYPI_API_TOKEN/\$\{\{secrets.PYPI_API_TOKEN\}\}/g' .github/workflows/publish.yml | |
cd .. | |
- name: Pushes to sdk repository | |
uses: cpina/github-action-push-to-another-repository@main | |
env: | |
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY_PY }} | |
API_TOKEN_GITHUB: ${{ secrets.PUSH_GITHUB_TOKEN }} | |
with: | |
source-directory: "python-client" | |
destination-github-username: "dofusdude" | |
destination-repository-name: "dofusdude-py" | |
user-email: stelzo@steado.de | |
target-branch: main | |
generate-php-client: | |
runs-on: ubuntu-latest | |
name: Generate php sdk | |
steps: | |
- name: Checkout OpenAPI | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Generate php sdk | |
uses: openapi-generators/openapitools-generator-action@v1 | |
with: | |
generator: php | |
openapi-file: openapi-3.0.yaml | |
command-args: --additional-properties=packageName=dofusdude-php | |
- name: Add actions | |
run: | | |
cd php-client | |
mkdir -p .github/workflows/ | |
printf '%s\n' 'name: PHP Composer' 'on:' ' push:' ' branches: [ "main" ]' 'permissions:' ' contents: read' 'jobs:' ' build:' ' runs-on: ubuntu-latest' ' steps:' ' - uses: actions/checkout@v3' ' - name: Validate composer.json and composer.lock' ' run: composer validate --strict' ' - name: Cache Composer packages' ' id: composer-cache' ' uses: actions/cache@v3' ' with:' ' path: vendor' ' key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}' ' restore-keys: |' ' ${{ runner.os }}-php-' ' - name: Install dependencies' ' run: composer install --prefer-dist --no-progress' > .github/workflows/build.yml | |
grep -rl GIT_USER_ID . | xargs sed -i 's/GIT_USER_ID\/GIT_REPO_ID/\dofusdude\/dofusdude-php/g' | |
sed -i 's/\\"/"/g' README.md | |
sed -i 's/"description"/"name": "dofusdude\/dofusdude-php",\n "description"/g' composer.json | |
cd .. | |
- name: Pushes to another repository | |
uses: cpina/github-action-push-to-another-repository@main | |
env: | |
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY_PHP }} | |
API_TOKEN_GITHUB: ${{ secrets.PUSH_GITHUB_TOKEN }} | |
with: | |
source-directory: "php-client" | |
destination-github-username: "dofusdude" | |
destination-repository-name: "dofusdude-php" | |
user-email: stelzo@steado.de | |
target-branch: main |