]> Untitled Git - lemmy.git/blob - docker/prod/deploy.sh
Merge branch 'master' into iav-arm-musl-dessalines
[lemmy.git] / docker / prod / deploy.sh
1 #!/bin/sh
2 set -e
3 git checkout master
4
5 # Import translations
6 git fetch weblate
7 git merge weblate/master
8
9 # Creating the new tag
10 new_tag="$1"
11 third_semver=$(echo $new_tag | cut -d "." -f 3)
12
13 # Setting the version on the front end
14 cd ../../
15 echo "export const version: string = '$new_tag';" > "ui/src/version.ts"
16 git add "ui/src/version.ts"
17 # Setting the version on the backend
18 echo "pub const VERSION: &str = \"$new_tag\";" > "server/src/version.rs"
19 git add "server/src/version.rs"
20 # Setting the version for Ansible
21 echo $new_tag > "ansible/VERSION"
22 git add "ansible/VERSION"
23
24 cd docker/prod || exit
25
26 # Changing the docker-compose prod
27 sed -i "s/dessalines\/lemmy:.*/dessalines\/lemmy:$new_tag/" ../prod/docker-compose.yml
28 sed -i "s/dessalines\/lemmy:.*/dessalines\/lemmy:$new_tag/" ../../ansible/templates/docker-compose.yml
29 git add ../prod/docker-compose.yml
30 git add ../../ansible/templates/docker-compose.yml
31
32 # The commit
33 git commit -m"Version $new_tag"
34 git tag $new_tag
35
36 export COMPOSE_DOCKER_CLI_BUILD=1
37 export DOCKER_BUILDKIT=1
38
39 # Rebuilding docker
40 if [ $third_semver -eq 0 ]; then
41   # TODO get linux/arm/v7 build working
42   # Build for Raspberry Pi / other archs too
43   docker buildx build --platform linux/amd64,linux/arm64 ../../ \
44     --file Dockerfile \
45     --tag dessalines/lemmy:$new_tag \
46     --push
47 else
48   docker buildx build --platform linux/amd64 ../../ \
49     --file Dockerfile \
50     --tag dessalines/lemmy:$new_tag \
51     --push
52 fi
53
54 # Push
55 git push origin $new_tag
56 git push
57
58 # Pushing to any ansible deploys
59 cd ../../../lemmy-ansible || exit
60 ansible-playbook -i prod playbooks/site.yml --vault-password-file vault_pass