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
|
||||
|
||||
steps:
|
||||
- name: build angestoepselt site
|
||||
image: plugins/docker
|
||||
settings:
|
||||
registry: codeberg.org
|
||||
username:
|
||||
- name: build sites
|
||||
image: gcr.io/kaniko-project/executor:v1.9.0-debug
|
||||
environment:
|
||||
DOCKER_USERNAME:
|
||||
from_secret: registry_username
|
||||
password:
|
||||
DOCKER_PASSWORD:
|
||||
from_secret: registry_password
|
||||
repo: codeberg.org/angestoepselt/homepage
|
||||
build_args:
|
||||
- SITE=angestoepselt
|
||||
tags: angestoepselt-${DRONE_BRANCH}
|
||||
DOCKER_REGISTRY: codeberg.org
|
||||
IMAGE_BASE: codeberg.org/angestoepselt/homepage
|
||||
commands:
|
||||
- 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
|
||||
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
|
||||
- name: deploy staging environment
|
||||
image: plugins/webhook
|
||||
settings:
|
||||
urls:
|
||||
from_secret: portainer_stage_url
|
||||
depends_on:
|
||||
- build angestoepselt site
|
||||
- build sites
|
||||
when:
|
||||
branch:
|
||||
- stage
|
||||
exclude:
|
||||
- main
|
||||
|
||||
- name: deploy live build
|
||||
- name: deploy production environment
|
||||
image: plugins/webhook
|
||||
settings:
|
||||
urls:
|
||||
from_secret: portainer_main_url
|
||||
depends_on:
|
||||
- build angestoepselt site
|
||||
- build coderdojo site
|
||||
when:
|
||||
branch:
|
||||
- main
|
||||
|
|
@ -70,11 +57,8 @@ steps:
|
|||
"repo": "{{ repo.name }}"
|
||||
}
|
||||
depends_on:
|
||||
- deploy live build
|
||||
- deploy production environment
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
||||
- stage
|
||||
event:
|
||||
- push
|
||||
- push
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ COPY includes /build/includes/
|
|||
COPY sites/${SITE} /build/sites/${SITE}/
|
||||
# These are symlinked from other sites:
|
||||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ version: '3'
|
|||
|
||||
services:
|
||||
angestoepselt:
|
||||
image: codeberg.org/angestoepselt/homepage:angestoepselt-${BRANCH:-main}
|
||||
image: codeberg.org/angestoepselt/homepage/angestoepselt:${BRANCH:-main}
|
||||
container_name: homepage-angestoepselt-${BRANCH:-main}
|
||||
restart: unless-stopped
|
||||
env_file: stack.env
|
||||
|
|
@ -20,7 +20,7 @@ services:
|
|||
- proxy
|
||||
|
||||
coderdojo:
|
||||
image: codeberg.org/angestoepselt/homepage:coderdojo-${BRANCH:-main}
|
||||
image: codeberg.org/angestoepselt/homepage/coderdojo:${BRANCH:-main}
|
||||
container_name: homepage-coderdojo-${BRANCH:-main}
|
||||
restart: unless-stopped
|
||||
env_file: stack.env
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
../../../angestoepselt/_static/assets/logos
|
||||
Loading…
Add table
Reference in a new issue