mastodon/.woodpecker.yml

67 lines
2.0 KiB
YAML
Raw Normal View History

2023-03-17 04:09:27 +00:00
variables:
2023-04-24 09:22:10 +00: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 04:09:27 +00:00
docker-step: &docker-step
2022-12-28 22:27:57 +00:00
image: docker:rc-git
volumes:
- /var/run/docker.sock:/var/run/docker.sock
2023-03-17 04:09:27 +00:00
environment:
2023-04-24 09:22:10 +00:00
<<: *docker-environment
2023-04-22 07:20:04 +00:00
clone:
git:
image: woodpeckerci/plugin-git
settings:
partial: false
depth: 10
2023-03-17 04:09:27 +00:00
pipeline:
build-base:
2023-03-17 04:09:27 +00:00
<<: *docker-step
2022-11-12 10:50:24 +00:00
commands:
2022-12-28 22:27:57 +00:00
- docker version
- docker image build -f Dockerfile --build-arg SOURCE_TAG=$CI_COMMIT_SHA . --target build-base -t $NAME:build-base
# 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'
build:
<<: *docker-step
commands:
2023-04-24 07:05:57 +00:00
- eval $DATE_COMMAND
- export TAG=$${COMMIT_DATE}.$CI_COMMIT_SHA && echo $${TAG}
2023-03-17 04:09:27 +00:00
- docker image build -f Dockerfile --build-arg SOURCE_TAG=$CI_COMMIT_SHA . -t $NAME:latest
2023-04-24 07:05:57 +00:00
- docker tag $NAME:latest $NAME:$TAG
# idk what's actually persisted between steps
# /shrug this works, so,???
- echo $${TAG} > tags.txt
- echo latest >> tags.txt
2023-03-17 04:09:27 +00: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 10:50:24 +00:00
push:
2023-03-17 04:09:27 +00:00
<<: *docker-step
2022-11-12 10:50:24 +00:00
commands:
2023-04-24 07:05:57 +00:00
- echo $REGISTRY_SECRET | docker login -u $REGISTRY_USER --password-stdin gitea.treehouse.systems
2023-04-24 09:22:10 +00:00
- cat tags.txt | xargs -n 1 -I% echo docker image push $NAME:%
2023-04-24 07:05:57 +00:00
- cat tags.txt | xargs -n 1 -I% docker image push $NAME:%
2022-11-12 10:50:24 +00:00
when:
event: [push, tag]
branch: main
2022-11-12 14:08:48 +00:00
secrets: [REGISTRY_SECRET]
2023-04-24 07:05:57 +00:00
environment:
2023-04-24 09:22:10 +00:00
<<: *docker-environment
2023-04-24 07:05:57 +00:00
REGISTRY_USER: ariadne