Merge branch 'main' into dev
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
FROM alpine:3.12
|
FROM python:3.10-slim-bullseye
|
||||||
RUN apk update && apk add --no-cache bash git openssh python3 py3-pip graphviz gcc
|
|
||||||
|
|
||||||
RUN python3 -m pip install --upgrade pip setuptools wheel pyparsing pydot django-extensions django
|
|
||||||
|
|
||||||
|
RUN apt-get update -y && apt-get install -y --no-install-recommends bash git graphviz graphviz-dev musl-dev build-essential gcc && apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|||||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2020 noah UG
|
Copyright (c) 2020 noah GmbH
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ on:
|
|||||||
- master
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
prettier:
|
graph-models:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -39,7 +39,7 @@ jobs:
|
|||||||
ref: ${{ github.head_ref }}
|
ref: ${{ github.head_ref }}
|
||||||
|
|
||||||
- name: Generate Data Schema
|
- name: Generate Data Schema
|
||||||
uses: noah-software/django_action@v1.0
|
uses: noah-software/django_action@v1.1
|
||||||
with:
|
with:
|
||||||
# This part is also where you can pass other options, for example:
|
# This part is also where you can pass other options, for example:
|
||||||
pip_path: testfolder/app/requirements.txt
|
pip_path: testfolder/app/requirements.txt
|
||||||
|
|||||||
28
entrypoint.sh
Executable file → Normal file
28
entrypoint.sh
Executable file → Normal file
@@ -1,39 +1,31 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
# e is for exiting the script automatically if a command fails, u is for exiting if a variable is not set
|
# e is for exiting the script automatically if a command fails, u is for exiting if a variable is not set
|
||||||
# x would be for showing the commands before they are executed
|
# x would be for showing the commands before they are executed
|
||||||
set -eu
|
set -eux
|
||||||
|
|
||||||
# FUNCTIONS
|
# FUNCTIONS
|
||||||
# Function for setting up git env in the docker container (copied from https://github.com/stefanzweifel/git-auto-commit-action/blob/master/entrypoint.sh)
|
# Function for setting up git env in the docker container (copied from https://github.com/stefanzweifel/git-auto-commit-action/blob/master/entrypoint.sh)
|
||||||
_git_setup ( ) {
|
_git_setup ( ) {
|
||||||
cat <<- EOF > $HOME/.netrc
|
|
||||||
machine github.com
|
|
||||||
login $GITHUB_ACTOR
|
|
||||||
password $GITHUB_TOKEN
|
|
||||||
machine api.github.com
|
|
||||||
login $GITHUB_ACTOR
|
|
||||||
password $GITHUB_TOKEN
|
|
||||||
EOF
|
|
||||||
chmod 600 $HOME/.netrc
|
|
||||||
|
|
||||||
git config --global user.email "actions@github.com"
|
git config --global user.email "actions@github.com"
|
||||||
git config --global user.name "GitHub Action"
|
git config --global user.name "GitHub Action"
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "Installing dependencies..."
|
echo "Installing dependencies..."
|
||||||
pip3 install --no-cache-dir -r $INPUT_PIP_PATH
|
pip3 install -U pip wheel pygraphviz
|
||||||
|
pip3 install --no-cache-dir -r "$INPUT_PIP_PATH"
|
||||||
|
|
||||||
echo "Creating data model..."
|
echo "Creating data model..."
|
||||||
cd $INPUT_PROJECT_PATH
|
cd "$INPUT_PROJECT_PATH"
|
||||||
python3 manage.py graph_models -a -g -o $INPUT_OUTPUT_PATH
|
python3 manage.py graph_models -a -g -o "$INPUT_OUTPUT_PATH"
|
||||||
|
|
||||||
# To keep runtime good, just continue if something was changed
|
# To keep runtime good, just continue if something was changed
|
||||||
if [[ `$(git status -s)` ]];
|
|
||||||
then
|
if [[ `git status --porcelain` ]]; then
|
||||||
# Calling method to configure the git environemnt
|
# Calling method to configure the git environemnt
|
||||||
_git_setup
|
_git_setup
|
||||||
# Commit and push changes back
|
# Commit and push changes back
|
||||||
git commit -a -m "$INPUT_COMMIT_MESSAGE" --author="$GITHUB_ACTOR <$GITHUB_ACTOR@users.noreply.github.com>"
|
git add "$INPUT_OUTPUT_PATH"
|
||||||
|
git commit -am "$INPUT_COMMIT_MESSAGE" --author="$GITHUB_ACTOR <$GITHUB_ACTOR@users.noreply.github.com>"
|
||||||
git push origin
|
git push origin
|
||||||
echo "Changes pushed successfully."
|
echo "Changes pushed successfully."
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user