-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upload api swagger-ui on release #6088
base: develop
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #6088 +/- ##
=========================================
- Coverage 81.6% 81.5% -0.1%
=========================================
Files 301 301
Lines 32257 32257
=========================================
- Hits 26328 26314 -14
- Misses 4211 4222 +11
- Partials 1718 1721 +3 ☔ View full report in Codecov by Sentry. |
- name: Extract dependency version | ||
id: go-sm-api-version | ||
run: | | ||
version=$(grep -E 'github.com/spacemeshos/api/release/go' go.mod | awk '{print $2}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A dependency can appear multiple times in the go.mod
file (e.g. when using replacements) a safer command to get the version of a dependency that is used to build the binary would be:
version=$(grep -E 'github.com/spacemeshos/api/release/go' go.mod | awk '{print $2}') | |
version=$(go list -m 'github.com/spacemeshos/api/release/go' | awk '{print $2}') |
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: 'refs/tags/${{ github.event.release.tag_name }}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this need to be specified? Won't the event be triggered on the reference of the tag anyway?
env: | ||
AWS_S3_BUCKET: ${{ secrets.CLOUDFLARE_API_BUCKET }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_SECRET_ACCESS_KEY }} | ||
SOURCE_DIR: api/release/openapi/swagger/dist | ||
DEST_DIR: '' | ||
AWS_S3_ENDPOINT: https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am reading this as a new build overwrites an existing one? We also publish test builds that are not intended to be used on mainnet and it would be bad if those overwrote the existing swagger file.
Would it be possible to upload the swagger file to a path that is different on a per git reference / tag basis?
- 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_API_BUCKET }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_SECRET_ACCESS_KEY }} | ||
SOURCE_DIR: api/release/openapi/swagger/dist | ||
DEST_DIR: '' | ||
AWS_S3_ENDPOINT: https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We definitely don't use the same versions on mainnet and testnet. Can this be changed that new versions don't overwrite the existing api definition?
Motivation
Automate the process of building and deploying the spacemeshos/api Swagger UI with each go-spacemesh release, ensuring consistent and up-to-date documentation.
Description
This PR introduces a new GitHub Action that automates the build and upload process of Swagger UI. It leverages the Swagger spec from the spacemeshos/api version in the current release of this repository.
Test Plan
Tested locally