mirror of
https://codeberg.org/angestoepselt/homepage.git
synced 2025-05-24 14:46:16 +00:00
Use a single staging environment for all branches
This commit reworks the CI setup to use a single staging environment and run it for every branch. That means the staging URL will always contain the most recent changes, independent of the branch.
This commit is contained in:
parent
8de3ff9dc8
commit
9ee5841842
4 changed files with 21 additions and 39 deletions
54
.drone.yml
54
.drone.yml
|
|
@ -2,51 +2,38 @@ kind: pipeline
|
||||||
name: homepage
|
name: homepage
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build angestoepselt site
|
- name: build sites
|
||||||
image: plugins/docker
|
image: gcr.io/kaniko-project/executor:v1.9.0-debug
|
||||||
settings:
|
environment:
|
||||||
registry: codeberg.org
|
DOCKER_USERNAME:
|
||||||
username:
|
|
||||||
from_secret: registry_username
|
from_secret: registry_username
|
||||||
password:
|
DOCKER_PASSWORD:
|
||||||
from_secret: registry_password
|
from_secret: registry_password
|
||||||
repo: codeberg.org/angestoepselt/homepage
|
DOCKER_REGISTRY: codeberg.org
|
||||||
build_args:
|
IMAGE_BASE: codeberg.org/angestoepselt/homepage
|
||||||
- SITE=angestoepselt
|
commands:
|
||||||
tags: angestoepselt-${DRONE_BRANCH}
|
- echo "{\"auths\":{\"$DOCKER_REGISTRY\":{\"username\":\"$DOCKER_USERNAME\",\"password\":\"$DOCKER_PASSWORD\"}}}" > /kaniko/.docker/config.json
|
||||||
|
- if [ "$DRONE_BRANCH" = "main" ]; then export TAG="main"; else export TAG="stage"; fi
|
||||||
|
- /kaniko/executor --cache --cache-dir=/cache --context . --destination "$IMAGE_BASE/angestoepselt:$TAG" --build-arg SITE=angestoepselt
|
||||||
|
- /kaniko/executor --cache --cache-dir=/cache --context . --destination "$IMAGE_BASE/coderdojo:$TAG" --build-arg SITE=coderdojo
|
||||||
|
|
||||||
- name: build coderdojo site
|
- name: deploy staging environment
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
registry: codeberg.org
|
|
||||||
username:
|
|
||||||
from_secret: registry_username
|
|
||||||
password:
|
|
||||||
from_secret: registry_password
|
|
||||||
repo: codeberg.org/angestoepselt/homepage
|
|
||||||
build_args:
|
|
||||||
- SITE=coderdojo
|
|
||||||
tags: coderdojo-${DRONE_BRANCH}
|
|
||||||
|
|
||||||
- name: deploy angestoepselt stage
|
|
||||||
image: plugins/webhook
|
image: plugins/webhook
|
||||||
settings:
|
settings:
|
||||||
urls:
|
urls:
|
||||||
from_secret: portainer_stage_url
|
from_secret: portainer_stage_url
|
||||||
depends_on:
|
depends_on:
|
||||||
- build angestoepselt site
|
- build sites
|
||||||
when:
|
when:
|
||||||
branch:
|
branch:
|
||||||
- stage
|
exclude:
|
||||||
|
- main
|
||||||
|
|
||||||
- name: deploy live build
|
- name: deploy production environment
|
||||||
image: plugins/webhook
|
image: plugins/webhook
|
||||||
settings:
|
settings:
|
||||||
urls:
|
urls:
|
||||||
from_secret: portainer_main_url
|
from_secret: portainer_main_url
|
||||||
depends_on:
|
|
||||||
- build angestoepselt site
|
|
||||||
- build coderdojo site
|
|
||||||
when:
|
when:
|
||||||
branch:
|
branch:
|
||||||
- main
|
- main
|
||||||
|
|
@ -70,11 +57,8 @@ steps:
|
||||||
"repo": "{{ repo.name }}"
|
"repo": "{{ repo.name }}"
|
||||||
}
|
}
|
||||||
depends_on:
|
depends_on:
|
||||||
- deploy live build
|
- deploy production environment
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
|
||||||
- main
|
|
||||||
- stage
|
|
||||||
event:
|
event:
|
||||||
- push
|
- push
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ COPY includes /build/includes/
|
||||||
COPY sites/${SITE} /build/sites/${SITE}/
|
COPY sites/${SITE} /build/sites/${SITE}/
|
||||||
# These are symlinked from other sites:
|
# These are symlinked from other sites:
|
||||||
COPY sites/angestoepselt/_images/home-banner.jpg /build/sites/angestoepselt/_images/
|
COPY sites/angestoepselt/_images/home-banner.jpg /build/sites/angestoepselt/_images/
|
||||||
COPY sites/angestoepselt/_static/assets/logos /build/sites/angestoepselt/_static/assets/logos/
|
|
||||||
|
|
||||||
RUN SITE=${SITE} npm run build
|
RUN SITE=${SITE} npm run build
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
angestoepselt:
|
angestoepselt:
|
||||||
image: codeberg.org/angestoepselt/homepage:angestoepselt-${BRANCH:-main}
|
image: codeberg.org/angestoepselt/homepage/angestoepselt:${BRANCH:-main}
|
||||||
container_name: homepage-angestoepselt-${BRANCH:-main}
|
container_name: homepage-angestoepselt-${BRANCH:-main}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file: stack.env
|
env_file: stack.env
|
||||||
|
|
@ -20,7 +20,7 @@ services:
|
||||||
- proxy
|
- proxy
|
||||||
|
|
||||||
coderdojo:
|
coderdojo:
|
||||||
image: codeberg.org/angestoepselt/homepage:coderdojo-${BRANCH:-main}
|
image: codeberg.org/angestoepselt/homepage/coderdojo:${BRANCH:-main}
|
||||||
container_name: homepage-coderdojo-${BRANCH:-main}
|
container_name: homepage-coderdojo-${BRANCH:-main}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file: stack.env
|
env_file: stack.env
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../../../angestoepselt/_static/assets/logos
|
|
||||||
Loading…
Add table
Reference in a new issue