2023-03-17 04:09:27 +00:00
variables :
docker-step : &docker-step
2022-12-28 22:27:57 +00:00
image : docker:rc-git
2022-11-12 10:55:53 +00:00
volumes :
- /var/run/docker.sock:/var/run/docker.sock
2023-03-17 04:09:27 +00:00
environment :
NAME : gitea.treehouse.systems/treehouse/mastodon
2023-04-24 07:05:57 +00:00
DATE_COMMAND : export COMMIT_DATE=$(date -u -Idate -d @$(git show -s --format=%ct))
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 :
2023-04-22 07:14:40 +00:00
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
2023-04-22 07:14:40 +00:00
- 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
- cat tags.txt | xargs -n 1 -I% docker image push $NAME:%
2022-11-12 10:50:24 +00:00
when :
event : [ push, tag]
2022-11-13 03:23:58 +00:00
branch : main
2022-11-12 14:08:48 +00:00
secrets : [ REGISTRY_SECRET]
2023-04-24 07:05:57 +00:00
environment :
REGISTRY_USER : ariadne