glitchier-soc/.woodpecker.yml

83 lines
2.7 KiB
YAML
Raw Normal View History

2023-03-17 06:09:27 +02:00
variables:
2023-04-24 12:22:10 +03:00
environment: &docker-environment
NAME: gitea.treehouse.systems/treehouse/mastodon
DATE_COMMAND: export COMMIT_DATE=$(date -u -Idate -d @$(git show -s --format=%ct))
2023-03-17 06:09:27 +02:00
docker-step: &docker-step
2022-12-29 00:27:57 +02:00
image: docker:rc-git
volumes:
- /var/run/docker.sock:/var/run/docker.sock
2023-03-17 06:09:27 +02:00
environment:
2023-04-24 12:22:10 +03:00
<<: *docker-environment
2023-04-22 10:20:04 +03:00
clone:
git:
image: woodpeckerci/plugin-git
settings:
partial: false
depth: 10
2023-04-22 10:20:04 +03:00
2023-03-17 06:09:27 +02:00
pipeline:
# build-base:
# <<: *docker-step
# commands:
# - docker version
# - docker image build -f Dockerfile --build-arg SOURCE_TAG=$CI_COMMIT_SHA . --target build-base -t $NAME:build-base
# build:
# <<: *docker-step
# commands:
# - docker version
# - docker image build -f Dockerfile --build-arg SOURCE_TAG=$CI_COMMIT_SHA . --target build -t $NAME:build
2023-07-07 08:46:49 +03:00
# output-base:
# <<: *docker-step
# commands:
# - docker version
# - docker image build -f Dockerfile --build-arg SOURCE_TAG=$CI_COMMIT_SHA . --target output-base -t $NAME:build
2023-07-07 08:46:49 +03:00
# the world is not yet ready for this step
# test:
# <<: *docker-step
# commands:
# - docker run --rm -e RAILS_ENV=test -e NODE_ENV=development $NAME:build-base sh -c 'bundle config set --local without development && bundle install && rake spec'
2023-07-07 08:46:49 +03:00
output:
<<: *docker-step
commands:
2023-04-24 10:05:57 +03:00
- eval $DATE_COMMAND
- export TAG=$${COMMIT_DATE}.$CI_COMMIT_SHA && echo $${TAG}
2023-03-17 06:09:27 +02:00
- docker image build -f Dockerfile --build-arg SOURCE_TAG=$CI_COMMIT_SHA . -t $NAME:latest
2024-02-03 06:11:11 +02:00
- docker image build -f streaming/Dockerfile --build-arg SOURCE_TAG=$CI_COMMIT_SHA . -t $NAME-streaming:latest
2023-04-24 10:05:57 +03:00
- docker tag $NAME:latest $NAME:$TAG
2024-02-03 06:11:11 +02:00
- docker tag $NAME-streaming:latest $NAME-streaming:$TAG
2023-04-24 10:05:57 +03:00
# idk what's actually persisted between steps
# /shrug this works, so,???
- echo $${TAG} > tags.txt
- echo latest >> tags.txt
2023-03-17 06:09:27 +02:00
# maybe we can use tags someday,,,
# tag-tag:
# image: *docker-git
# volumes:
# - /var/run/docker.sock:/var/run/docker.sock
# commands:
# - docker tag $NAME:latest $NAME:$CI_COMMIT_TAG
# when:
# event: tag
2022-11-12 12:50:24 +02:00
push:
2023-03-17 06:09:27 +02:00
<<: *docker-step
2022-11-12 12:50:24 +02:00
commands:
2023-04-24 10:05:57 +03:00
- echo $REGISTRY_SECRET | docker login -u $REGISTRY_USER --password-stdin gitea.treehouse.systems
2023-04-24 12:22:10 +03:00
- cat tags.txt | xargs -n 1 -I% echo docker image push $NAME:%
2023-04-24 10:05:57 +03:00
- cat tags.txt | xargs -n 1 -I% docker image push $NAME:%
2024-02-03 06:11:11 +02:00
- cat tags.txt | xargs -n 1 -I% echo docker image push $NAME-streaming:%
- cat tags.txt | xargs -n 1 -I% docker image push $NAME-streaming:%
2022-11-12 12:50:24 +02:00
when:
event: [push, tag]
branch: main
2022-11-12 16:08:48 +02:00
secrets: [REGISTRY_SECRET]
2023-04-24 10:05:57 +03:00
environment:
2023-04-24 12:22:10 +03:00
<<: *docker-environment
2023-04-24 10:05:57 +03:00
REGISTRY_USER: ariadne