Merge branch 'main' into dev
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
FROM alpine:3.12
|
||||
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
|
||||
FROM python:3.10-slim-bullseye
|
||||
|
||||
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
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
||||
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
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -28,7 +28,7 @@ on:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
prettier:
|
||||
graph-models:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
@@ -39,7 +39,7 @@ jobs:
|
||||
ref: ${{ github.head_ref }}
|
||||
|
||||
- name: Generate Data Schema
|
||||
uses: noah-software/django_action@v1.0
|
||||
uses: noah-software/django_action@v1.1
|
||||
with:
|
||||
# This part is also where you can pass other options, for example:
|
||||
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
|
||||
# x would be for showing the commands before they are executed
|
||||
set -eu
|
||||
set -eux
|
||||
|
||||
# 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)
|
||||
_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.name "GitHub Action"
|
||||
}
|
||||
|
||||
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..."
|
||||
cd $INPUT_PROJECT_PATH
|
||||
python3 manage.py graph_models -a -g -o $INPUT_OUTPUT_PATH
|
||||
cd "$INPUT_PROJECT_PATH"
|
||||
python3 manage.py graph_models -a -g -o "$INPUT_OUTPUT_PATH"
|
||||
|
||||
# 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
|
||||
_git_setup
|
||||
# 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
|
||||
echo "Changes pushed successfully."
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user