-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed script in github workflow to relative path (#944)
Signed-off-by: Paul Schultz <[email protected]>
- Loading branch information
1 parent
f69fa52
commit ce66cff
Showing
6 changed files
with
106 additions
and
77 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Publish Devfile Schema | ||
|
||
# Triggers the workflow on push events but only for the main branch | ||
on: | ||
push: | ||
branches: [main] | ||
|
||
# Only allow one job of this action to be ran at a time | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
publish-json-schema: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Checkout devfile/devfile-web | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: devfile/devfile-web | ||
persist-credentials: false | ||
path: devfile-web-repo | ||
|
||
- name: Checkout devfile api | ||
uses: actions/checkout@v2 | ||
with: | ||
path: api-repo | ||
|
||
- name: Get the version being published | ||
id: get_version | ||
run: echo ::set-output name=version::$(cat api-repo/schemas/latest/jsonSchemaVersion.txt) | ||
|
||
- name: Publish the new version on devfile-web | ||
working-directory: devfile-web-repo/ | ||
run: | | ||
python ./python/src/api_workflow/api_workflow.py --version ${{ steps.get_version.outputs.version }} --devfile-schema ../api-repo/schemas/latest/devfile.json | ||
- name: Push to the devfile/devfile-web repo | ||
working-directory: devfile-web-repo/ | ||
run: | | ||
# Install dependencies to format the commit | ||
yarn install | ||
# Format the commit | ||
yarn nx format:write | ||
# Lint the commit | ||
yarn nx affected --target=lint | ||
yarn nx format:check | ||
# Don't commit if there are no changes | ||
if [ "$(git status -s)" == "" ]; then | ||
echo "Nothing to commit" | ||
exit 0 | ||
fi | ||
lastCommit="$(cd ../api-repo; git log -1 --format=%H)" | ||
lastCommitterName="$(cd ../api-repo; git log -1 --format=%an)" | ||
lastCommitterEmail="$(cd ../api-repo; git log -1 --format=%ae)" | ||
git config --global user.email "${lastCommitterEmail}" | ||
git config --global user.name "${lastCommitterName}" | ||
git add . | ||
git commit -asm "Update devfile schema based on devfile/api@${lastCommit}" | ||
git push "https://devfile-robot:${{secrets.DOCS_UPDATE_SECRET}}@github.com/devfile/devfile-web" |
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
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