Skip to content

Commit

Permalink
add autosetup
Browse files Browse the repository at this point in the history
  • Loading branch information
reschandreas committed Dec 26, 2023
1 parent 9017083 commit 30624f0
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 2 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/deploy-develop-branch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Deploy to develop

on:
pull_request:
types: [unlabeled]

jobs:
get-removed-labels:
runs-on: ubuntu-latest
steps:
- name: Get the removed label
run: |
# The path to the JSON file with the event payload
EVENT_PAYLOAD_PATH=${{ github.event_path }}
# Extract the label name using jq (a lightweight and flexible command-line JSON processor)
LABEL_NAME=$(jq '.label.name' $EVENT_PAYLOAD_PATH)
# Output the label name
echo "The removed label is: $LABEL_NAME"
return $LABEL_NAME
# Deploy to develop to test server
deploy:
needs: [ get-removed-labels ]
uses: ./.github/workflows/deploy.yaml
if: ${{ needs.get-removed-labels.outputs.result }} == 'deploy:aeolus-test' || ${{ needs.get-removed-labels.outputs.result }} == 'lock:aeolus-test'
with:
docker-tag: "nightly"
branch-name: "develop"
environment-name: aeolus-dev
environment-url: https://aeolus-test.artemis.cit.tum.de
secrets: inherit


# Check that the build job has run successfully otherwise add an error label
add-error-label:
needs: [ deploy ]
runs-on: ubuntu-latest
if: ${{ failure() }}
steps:
- name: Add error label
uses: actions-ecosystem/action-add-labels@v1
with:
labels: deployment-error
10 changes: 8 additions & 2 deletions deployment/aeolus-docker
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ function start {
cd $WORKING_DIR || exit
git clone https://github.com/ls1intum/Aeolus.git -b "$pr_branch" Aeolus
sed -i "s/AEOLUS_DOCKER_TAG=.*/AEOLUS_DOCKER_TAG='$pr_tag'/g" $ENV_FILE
if [ ! -f "$WORKING_DIR/docker.env" ]; then
wget -O "$WORKING_DIR/docker.env" https://raw.githubusercontent.com/ls1intum/Aeolus/develop/.env.example
sed -i "s/AEOLUS_DOCKER_TAG=.*/AEOLUS_DOCKER_TAG='$pr_tag'/g" $WORKING_DIR/docker.env
local _hostname
_hostname=$(hostname)
sed -i "s/AEOLUS_HOST=.*/AEOLUS_HOST='${_hostname}'/g" $WORKING_DIR/docker.env
fi
if [ ! -f "$WORKING_DIR/acme.json" ]; then
touch "$WORKING_DIR/acme.json"
chmod 600 "$WORKING_DIR/acme.json"
Expand All @@ -42,14 +49,13 @@ function start {
}

function stop {
# TODO: In the future extract pr_tag and pr_branch from env

echo "Stopping aeolus"
docker compose -f "$PROJECT_DIR/$COMPOSE_FILE" --env-file "$ENV_FILE" down
}

function restart {
stop "$@"
sleep 1
start "$@"
}

Expand Down

0 comments on commit 30624f0

Please sign in to comment.