]> Untitled Git - lemmy.git/blob - docker/prod/deploy.sh
Merge branch 'main' into move_matrix_and_admin_to_person
[lemmy.git] / docker / prod / deploy.sh
1 #!/bin/sh
2 set -e
3 #git checkout main
4
5 # Creating the new tag
6 new_tag="$1"
7 third_semver=$(echo $new_tag | cut -d "." -f 3)
8
9 # Setting the version on the backend
10 pushd ../../
11 echo "pub const VERSION: &str = \"$new_tag\";" > "crates/utils/src/version.rs"
12 git add "crates/utils/src/version.rs"
13 popd
14
15 # Changing various references to the Lemmy version
16 sed -i "s/dessalines\/lemmy-ui:.*/dessalines\/lemmy-ui:$new_tag/" ../dev/docker-compose.yml
17 sed -i "s/dessalines\/lemmy-ui:.*/dessalines\/lemmy-ui:$new_tag/" ../federation/docker-compose.yml
18 git add ../dev/docker-compose.yml
19 git add ../federation/docker-compose.yml
20
21 # The ansible and docker installs should only update for non release-candidates
22 # IE, when the third semver is a number, not '2-rc'
23 if [ ! -z "${third_semver##*[!0-9]*}" ]; then
24   sed -i "s/dessalines\/lemmy:.*/dessalines\/lemmy:$new_tag/" ../prod/docker-compose.yml
25   git add ../prod/docker-compose.yml
26
27   # Setting the version for Ansible
28   pushd ../../
29   echo $new_tag > "ansible/VERSION"
30   git add "ansible/VERSION"
31   popd
32 fi
33
34 # The commit
35 git commit -m"Version $new_tag"
36 git tag $new_tag
37
38 # export COMPOSE_DOCKER_CLI_BUILD=1
39 # export DOCKER_BUILDKIT=1
40
41 # Push
42 git push origin $new_tag
43 git push
44
45 # Pushing to any ansible deploys
46 # cd ../../../lemmy-ansible || exit
47 # ansible-playbook -i prod playbooks/site.yml --vault-password-file vault_pass