-
Notifications
You must be signed in to change notification settings - Fork 9
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
set up actions workflow and config documentation #55
Conversation
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.
For the whole PR: let's name the variables with lower case as it usually done.
|
||
- name: remove spec from swaggerhub | ||
env: | ||
AUTH_TOKEN: ${{secrets.SGH_TOKEN}} |
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.
May we name it SWAGGERHUB_TOKEN
? As for me it will be more clear for anyone who will read action file and configure secrets.
version=${RELEASE_VERSION} | ||
version=`echo $version|sed 's#[^a-zA-Z0-9_\.\-]#_#g'` | ||
echo "removing API spec: ${version} from swaggerhub" | ||
curl -X DELETE "https://api.swaggerhub.com/apis/idoko/moira-alert/${version}" -H "content-type: application/yaml" -H "Authorization: ${AUTH_TOKEN}" |
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.
This URL should be used https://app.swaggerhub.com/organizations/Moira
. I actually think that it will be better to move main part of URL to variable.
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've updated it to be a variable under the env:
section, not sure if that was what you meant anyway.
node-version: '14' | ||
- run: npm install -g swagger-cli | ||
- run: make spec | ||
- run: pwd |
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.
Is it debugging output?
- uses: actions/checkout@v2 | ||
- name: set output for versioning | ||
id: vars | ||
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} |
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.
Probably we should use here '
to prevent substitution of *
with glob?
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.
Right. Added double quotes now.
echo "Uploading OpenAPI spec v ${RELEASE_VERSION}" | ||
pwd | ||
def=`cat ./build/openapi.yml` | ||
curl -d "$def" "https://api.swaggerhub.com/apis/idoko/moira-alert/?isPrivate=false&version=${version}&oas=3.0.0&force=true" -H "content-type: application/yaml" -H "Authorization: ${AUTH_TOKEN}" |
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.
Same wrong URL
version=${RELEASE_VERSION} | ||
version=`echo $version|sed 's#[^a-zA-Z0-9_\.\-]#_#g'` | ||
echo "Uploading OpenAPI spec v ${RELEASE_VERSION}" | ||
pwd |
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.
Also seems as a debugging output
0b0d760
to
3339241
Compare
version=${RELEASE_VERSION} | ||
version=`echo $version|sed 's#[^a-zA-Z0-9_\.\-]#_#g'` | ||
echo "removing API spec: ${version} from swaggerhub" | ||
curl -X DELETE "https://api.swaggerhub.com/apis/idoko/moira-alert/${version}" -H "content-type: application/yaml" -H "Authorization: ${AUTH_TOKEN}" |
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 guess I'd have to wait for the swaggerhub account to be ready before changing the URL. What do you think?
- uses: actions/checkout@v2 | ||
- name: set output for versioning | ||
id: vars | ||
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} |
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.
Right. Added double quotes now.
version=${RELEASE_VERSION} | ||
version=`echo $version|sed 's#[^a-zA-Z0-9_\.\-]#_#g'` | ||
echo "removing API spec: ${version} from swaggerhub" | ||
curl -X DELETE "https://api.swaggerhub.com/apis/idoko/moira-alert/${version}" -H "content-type: application/yaml" -H "Authorization: ${AUTH_TOKEN}" |
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've updated it to be a variable under the env:
section, not sure if that was what you meant anyway.
This adds the Github Actions workflow for publishing OpenAPI definitions to SwaggerHub and deleting them. It also includes a documentation for the
config
route so that CI has something to work with.To make it work, we will need a SwaggerHub account, and a Github secret named
SGH_TOKEN
which contains the SwaggerHub API token.