Skip to content

Changed script in github workflow to relative path #944

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

Merged
merged 7 commits into from
Sep 23, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/che.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@

# Add Che link on PRs
name: che
name: Che

on:
pull_request:
pull_request:
types: [opened, synchronize]

# 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:
add-link:
runs-on: ubuntu-latest
Expand Down
71 changes: 5 additions & 66 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ on:
pull_request:
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:
build-and-validate:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -65,69 +70,3 @@ jobs:
run: |
go fmt -x ./...
git diff --exit-code || { echo 'Go sources need to be formatted. Execute "go fmt -x ./..." locally in the 'generator' folder and commit changes to fix an issue'; exit 1; }
- name: Upload Json schemas
uses: actions/upload-artifact@v2
with:
name: devfile-json-schema
path: schemas/latest/devfile.json

publish-next-json-schema:
if: success() && github.event_name == 'push'
runs-on: ubuntu-latest
needs: [build-and-validate]
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Checkout devfile docs
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
run: |
cd devfile-web-repo/
python devfile-web-repo/python/src/api_workflow/api_workflow.py --version ${{ steps.get_version.outputs.version }} --devfile-schema api-repo/schemas/latest/devfile.json --release

- 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"
6 changes: 6 additions & 0 deletions .github/workflows/codecov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ 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:
build-and-deploy:
runs-on: ubuntu-20.04
Expand Down
71 changes: 71 additions & 0 deletions .github/workflows/publish-devfile-schema.yaml
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 docs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you rename this step, no longer called devfile docs, probably 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"
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
release:
types: [published]

# 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:
release-json-schema:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -33,7 +38,7 @@ jobs:
- name: Release new version on devfile-web
run: |
cd devfile-web-repo/
python devfile-web-repo/python/src/api_workflow/api_workflow.py --version ${{ steps.get_version.outputs.version }} --devfile-schema api-repo/schemas/latest/devfile.json --release
python ./python/src/api_workflow/api_workflow.py --version ${{ steps.get_version.outputs.version }} --devfile-schema api-repo/schemas/latest/devfile.json --release
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
python ./python/src/api_workflow/api_workflow.py --version ${{ steps.get_version.outputs.version }} --devfile-schema api-repo/schemas/latest/devfile.json --release
python ./python/src/api_workflow/api_workflow.py --version ${{ steps.get_version.outputs.version }} --devfile-schema ../api-repo/schemas/latest/devfile.json --release

should be?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed already


- name: Push to the devfile/devfile-web repo
working-directory: devfile-web-repo/
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/release-typescript-models.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@

# Release a typescript package to npm containing the typescript types generated from the latest merged crds
name: types
name: Release Typescript Models

on:
push:
branches: [ main ]
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:
release-typescript-models:
Expand All @@ -23,7 +27,7 @@ jobs:
- name: Install Python dependencies
uses: py-actions/py-dependency-install@v2
with:
path: "api/build/typescript-model/requirements.txt"
path: 'api/build/typescript-model/requirements.txt'

- name: Setup node
uses: actions/setup-node@v1
Expand All @@ -37,8 +41,8 @@ jobs:
./build/typescript-model/generate.sh
cp -r ./build/typescript-model/workdir/typescript-models ../
working-directory: api
- name: Release typescript models

- name: Release typescript models
run: |
VERSION=$(cat $GITHUB_WORKSPACE/api/schemas/latest/jsonSchemaVersion.txt)
yarn --new-version version "$VERSION-$(date +%s)" --no-git-tag-version
Expand Down