fixed some bugs #67
This file contains hidden or 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 and Release NEAR RPC Client | |
| on: | |
| workflow_dispatch: | |
| push: | |
| schedule: | |
| - cron: "0 0 * * *" # daily run (every day at midnight) | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-and-release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: true | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: temurin | |
| java-version: 21 | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x ./gradlew | |
| - name: Run Generator | |
| run: ./gradlew :generator:run --no-daemon | |
| - name: Build project | |
| run: ./gradlew build --stacktrace --no-daemon | |
| - name: Create ZIP artifact | |
| run: | | |
| mkdir -p release | |
| zip -r release/near-rpc-client.zip build/libs/* | |
| - name: Get Release ID | |
| id: get_release | |
| uses: actions/github-script@v6 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const releases = await github.rest.repos.listReleases({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo | |
| }); | |
| const release = releases.data.find(r => r.tag_name === "v0.1.0"); | |
| if (release) { | |
| return release.id; | |
| } else { | |
| const newRelease = await github.rest.repos.createRelease({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| tag_name: "v0.1.0", | |
| name: "NEAR RPC Client v0.1.0", | |
| body: "Auto-generated client from the latest OpenAPI spec. Includes updated models and client code." | |
| }); | |
| return newRelease.data.id; | |
| } | |
| - name: Upload ZIP to Release | |
| uses: actions/upload-release-asset@v1 | |
| with: | |
| upload_url: ${{ steps.get_release.outputs.result }} | |
| asset_path: release/near-rpc-client.zip | |
| asset_name: near-rpc-client.zip | |
| asset_content_type: application/zip |