From c16d4bb0d763110ee66c6f863436862f3b80bb38 Mon Sep 17 00:00:00 2001 From: andres-spacemesh <106999199+andres-spacemesh@users.noreply.github.com> Date: Thu, 27 Jun 2024 16:09:15 -0700 Subject: [PATCH 1/7] fix sync release with go-spacemesh --- .github/workflows/swagger_build-deploy.yml | 59 ++++++++++++++++++++-- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/.github/workflows/swagger_build-deploy.yml b/.github/workflows/swagger_build-deploy.yml index 73030b89..2c771b57 100644 --- a/.github/workflows/swagger_build-deploy.yml +++ b/.github/workflows/swagger_build-deploy.yml @@ -3,15 +3,54 @@ name: Build and Push Swagger-UI to R2 mainnet-api-docs.spacemesh.network on: push: branches: - - master + - fix-sync-with-go-sm paths: - 'release/openapi/swagger/src/**' jobs: + check-version: + runs-on: ubuntu-22.04 + outputs: + go-sm-release: ${{ steps.go-sm-release.outputs.GO_SM_RELEASE_VER }} + go-sm-api-version: ${{ steps.go-sm-api-version.outputs.GO_SM_API_VERSION }} + steps: + - uses: actions/checkout@v4 + with: + repository: spacemeshos/go-spacemesh + fetch-depth: 0 + - name: Get current go-sm release tag + id: go-sm-release + run: | + version=$(git describe --tags $(git rev-list --tags --max-count=1)) + echo "GO_SM_RELEASE_VER=$version" > $GITHUB_OUTPUT + + - name: Checkout target repository on last release + uses: actions/checkout@v4 + with: + repository: spacemeshos/go-spacemesh + path: go-spacemesh + fetch-depth: 0 + ref: 'refs/tags/${{ steps.go-sm-release.outputs.GO_SM_RELEASE_VER }}' + + - name: Extract dependency version + id: go-sm-api-version + run: | + version=$(grep -E 'github.com/spacemeshos/api/release/go' gomodtest/go.mod | awk '{print $2}') + echo "$version" + echo "GO_SM_API_VERSION=$version" > $GITHUB_OUTPUT + build-deploy: runs-on: ubuntu-22.04 + needs: check-version steps: + - name: Print versions + run: | + echo "API version on go-sm: ${{ needs.check-version.outputs.go-sm-api-version }}" + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: 'refs/tags/${{ needs.check-version.outputs.go-sm-api-version }}' - name: Use Node.js v20.14.0 uses: actions/setup-node@v4 with: @@ -30,7 +69,8 @@ jobs: name: swagger-ui-build path: release/openapi/swagger/dist - - uses: jakejarvis/s3-sync-action@master + - name: upload to mainnet + uses: jakejarvis/s3-sync-action@master with: args: --acl public-read --follow-symlinks --delete env: @@ -39,4 +79,17 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_SECRET_ACCESS_KEY }} SOURCE_DIR: release/openapi/swagger/dist DEST_DIR: '' - AWS_S3_ENDPOINT: https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com \ No newline at end of file + AWS_S3_ENDPOINT: https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com + + - name: upload to testnet + uses: jakejarvis/s3-sync-action@master + with: + args: --acl public-read --follow-symlinks --delete + env: + AWS_S3_BUCKET: ${{ secrets.CLOUDFLARE_TESTNET_BUCKET }} + AWS_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_SECRET_ACCESS_KEY }} + SOURCE_DIR: release/openapi/swagger/dist + DEST_DIR: '' + AWS_S3_ENDPOINT: https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com + \ No newline at end of file From 84c395165ced45584fe9da7e975a48fd974358d0 Mon Sep 17 00:00:00 2001 From: andres-spacemesh <106999199+andres-spacemesh@users.noreply.github.com> Date: Thu, 27 Jun 2024 16:13:49 -0700 Subject: [PATCH 2/7] test --- release/openapi/swagger/src/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/release/openapi/swagger/src/index.js b/release/openapi/swagger/src/index.js index 978883ae..1e20c33e 100644 --- a/release/openapi/swagger/src/index.js +++ b/release/openapi/swagger/src/index.js @@ -1,6 +1,7 @@ const SwaggerUI = require('swagger-ui'); require('swagger-ui/dist/swagger-ui.css'); const spec = require('./api.swagger.json'); + SwaggerUI({ spec, dom_id: '#swagger', From e70e41512c7b4d42c97247cd0fce10b37cc3a2ed Mon Sep 17 00:00:00 2001 From: andres-spacemesh <106999199+andres-spacemesh@users.noreply.github.com> Date: Thu, 27 Jun 2024 16:15:53 -0700 Subject: [PATCH 3/7] fix typo --- .github/workflows/swagger_build-deploy.yml | 2 +- release/openapi/swagger/src/index.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/swagger_build-deploy.yml b/.github/workflows/swagger_build-deploy.yml index 2c771b57..f7347f1f 100644 --- a/.github/workflows/swagger_build-deploy.yml +++ b/.github/workflows/swagger_build-deploy.yml @@ -35,7 +35,7 @@ jobs: - name: Extract dependency version id: go-sm-api-version run: | - version=$(grep -E 'github.com/spacemeshos/api/release/go' gomodtest/go.mod | awk '{print $2}') + version=$(grep -E 'github.com/spacemeshos/api/release/go' go-spacemesh/go.mod | awk '{print $2}') echo "$version" echo "GO_SM_API_VERSION=$version" > $GITHUB_OUTPUT diff --git a/release/openapi/swagger/src/index.js b/release/openapi/swagger/src/index.js index 1e20c33e..978883ae 100644 --- a/release/openapi/swagger/src/index.js +++ b/release/openapi/swagger/src/index.js @@ -1,7 +1,6 @@ const SwaggerUI = require('swagger-ui'); require('swagger-ui/dist/swagger-ui.css'); const spec = require('./api.swagger.json'); - SwaggerUI({ spec, dom_id: '#swagger', From 5d4fe14866011dafd9deb241dad48e3e02ef7444 Mon Sep 17 00:00:00 2001 From: andres-spacemesh <106999199+andres-spacemesh@users.noreply.github.com> Date: Thu, 27 Jun 2024 16:22:14 -0700 Subject: [PATCH 4/7] fix getting latest release from go-sm --- .github/workflows/swagger_build-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/swagger_build-deploy.yml b/.github/workflows/swagger_build-deploy.yml index f7347f1f..bdc6b2f3 100644 --- a/.github/workflows/swagger_build-deploy.yml +++ b/.github/workflows/swagger_build-deploy.yml @@ -21,7 +21,7 @@ jobs: - name: Get current go-sm release tag id: go-sm-release run: | - version=$(git describe --tags $(git rev-list --tags --max-count=1)) + version=$(git describe --tags --abbrev=0) echo "GO_SM_RELEASE_VER=$version" > $GITHUB_OUTPUT - name: Checkout target repository on last release From 117a1a90452079ba6073b3ec7132d934cf63097d Mon Sep 17 00:00:00 2001 From: andres-spacemesh <106999199+andres-spacemesh@users.noreply.github.com> Date: Thu, 27 Jun 2024 16:22:42 -0700 Subject: [PATCH 5/7] test --- release/openapi/swagger/src/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/release/openapi/swagger/src/index.js b/release/openapi/swagger/src/index.js index 978883ae..1e20c33e 100644 --- a/release/openapi/swagger/src/index.js +++ b/release/openapi/swagger/src/index.js @@ -1,6 +1,7 @@ const SwaggerUI = require('swagger-ui'); require('swagger-ui/dist/swagger-ui.css'); const spec = require('./api.swagger.json'); + SwaggerUI({ spec, dom_id: '#swagger', From 6a01be75f4cb312e70b9c9d18d341689c90e456d Mon Sep 17 00:00:00 2001 From: andres-spacemesh <106999199+andres-spacemesh@users.noreply.github.com> Date: Thu, 27 Jun 2024 16:26:52 -0700 Subject: [PATCH 6/7] update on-push branch --- .github/workflows/swagger_build-deploy.yml | 2 +- release/openapi/swagger/src/index.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/swagger_build-deploy.yml b/.github/workflows/swagger_build-deploy.yml index bdc6b2f3..56b98bf3 100644 --- a/.github/workflows/swagger_build-deploy.yml +++ b/.github/workflows/swagger_build-deploy.yml @@ -3,7 +3,7 @@ name: Build and Push Swagger-UI to R2 mainnet-api-docs.spacemesh.network on: push: branches: - - fix-sync-with-go-sm + - master paths: - 'release/openapi/swagger/src/**' diff --git a/release/openapi/swagger/src/index.js b/release/openapi/swagger/src/index.js index 1e20c33e..978883ae 100644 --- a/release/openapi/swagger/src/index.js +++ b/release/openapi/swagger/src/index.js @@ -1,7 +1,6 @@ const SwaggerUI = require('swagger-ui'); require('swagger-ui/dist/swagger-ui.css'); const spec = require('./api.swagger.json'); - SwaggerUI({ spec, dom_id: '#swagger', From 71266826540203aac580b302df1ad5c7f27cbe6a Mon Sep 17 00:00:00 2001 From: andres-spacemesh <106999199+andres-spacemesh@users.noreply.github.com> Date: Wed, 10 Jul 2024 07:37:13 -0700 Subject: [PATCH 7/7] remove swagger-ui workflow --- .github/workflows/swagger_build-deploy.yml | 95 ---------------------- 1 file changed, 95 deletions(-) delete mode 100644 .github/workflows/swagger_build-deploy.yml diff --git a/.github/workflows/swagger_build-deploy.yml b/.github/workflows/swagger_build-deploy.yml deleted file mode 100644 index 56b98bf3..00000000 --- a/.github/workflows/swagger_build-deploy.yml +++ /dev/null @@ -1,95 +0,0 @@ -name: Build and Push Swagger-UI to R2 mainnet-api-docs.spacemesh.network - -on: - push: - branches: - - master - paths: - - 'release/openapi/swagger/src/**' - -jobs: - check-version: - runs-on: ubuntu-22.04 - outputs: - go-sm-release: ${{ steps.go-sm-release.outputs.GO_SM_RELEASE_VER }} - go-sm-api-version: ${{ steps.go-sm-api-version.outputs.GO_SM_API_VERSION }} - steps: - - uses: actions/checkout@v4 - with: - repository: spacemeshos/go-spacemesh - fetch-depth: 0 - - name: Get current go-sm release tag - id: go-sm-release - run: | - version=$(git describe --tags --abbrev=0) - echo "GO_SM_RELEASE_VER=$version" > $GITHUB_OUTPUT - - - name: Checkout target repository on last release - uses: actions/checkout@v4 - with: - repository: spacemeshos/go-spacemesh - path: go-spacemesh - fetch-depth: 0 - ref: 'refs/tags/${{ steps.go-sm-release.outputs.GO_SM_RELEASE_VER }}' - - - name: Extract dependency version - id: go-sm-api-version - run: | - version=$(grep -E 'github.com/spacemeshos/api/release/go' go-spacemesh/go.mod | awk '{print $2}') - echo "$version" - echo "GO_SM_API_VERSION=$version" > $GITHUB_OUTPUT - - build-deploy: - runs-on: ubuntu-22.04 - needs: check-version - steps: - - name: Print versions - run: | - echo "API version on go-sm: ${{ needs.check-version.outputs.go-sm-api-version }}" - - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: 'refs/tags/${{ needs.check-version.outputs.go-sm-api-version }}' - - name: Use Node.js v20.14.0 - uses: actions/setup-node@v4 - with: - node-version: '20.14.0' - - - name: npm install - run: npm install - working-directory: release/openapi/swagger - - - name: npm build - run: npm run build - working-directory: release/openapi/swagger - - - uses: actions/upload-artifact@v4 - with: - name: swagger-ui-build - path: release/openapi/swagger/dist - - - name: upload to mainnet - uses: jakejarvis/s3-sync-action@master - with: - args: --acl public-read --follow-symlinks --delete - env: - AWS_S3_BUCKET: ${{ secrets.CLOUDFLARE_BUCKET }} - AWS_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_SECRET_ACCESS_KEY }} - SOURCE_DIR: release/openapi/swagger/dist - DEST_DIR: '' - AWS_S3_ENDPOINT: https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com - - - name: upload to testnet - uses: jakejarvis/s3-sync-action@master - with: - args: --acl public-read --follow-symlinks --delete - env: - AWS_S3_BUCKET: ${{ secrets.CLOUDFLARE_TESTNET_BUCKET }} - AWS_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_SECRET_ACCESS_KEY }} - SOURCE_DIR: release/openapi/swagger/dist - DEST_DIR: '' - AWS_S3_ENDPOINT: https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com - \ No newline at end of file