use properties instead of sed #74
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/[email protected] | |
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: [email protected] | |
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/[email protected] | |
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: [email protected] | |
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=licenseName=GPLv3,licenseUrl=https://www.gnu.org/licenses/gpl-3.0.txt,scmDeveloperConnection=scm:git:[email protected]:dofusdude/dofusdude-java.git,scmConnection=scm:git:[email protected]:dofusdude/dofusdude-java.git,apiPackage=com.dofusdude.client.api,artifactDescription=dofusdude-client,artifactId=dofusdude-java,artifactUrl=https://github.com/dofusdude/dofusdude-java,[email protected],developerName=stelzo,developerOrganization=dofusdude,developerOrganizationUrl=https://github.com/dofusdude,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: Build' 'on:' ' push:' ' branches: [ main ]' ' pull_request:' ' branches: [ main ]' 'jobs:' ' build:' ' runs-on: ubuntu-latest' ' steps:' ' - uses: actions/checkout@v4' ' - 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]' 'jobs:' ' deploy:' ' runs-on: ubuntu-latest' ' permissions:' ' contents: read' ' packages: write' ' steps:' ' - uses: actions/checkout@v4' ' - name: Set up Java' ' uses: actions/setup-java@v4' ' with:' ' java-version: "17"' ' distribution: "temurin"' ' - name: Release Maven package' ' run: mvn --batch-mode deploy' ' env:' ' GITHUB_TOKEN: secrets.GITHUB_TOKEN' > .github/workflows/publish.yml | |
sed -i 's/secrets.GITHUB_TOKEN/\$\{\{secrets.GITHUB_TOKEN\}\}/g' .github/workflows/publish.yml | |
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|</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>github</id><name>GitHub Packages</name><url>https://maven.pkg.github.com/dofusdude/dofusdude-java</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: [email protected] | |
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/[email protected] | |
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: [email protected] | |
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/[email protected] | |
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: [email protected] | |
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: [email protected] | |
target-branch: main |