]> Untitled Git - lemmy.git/blob - docker/prod/deploy.sh
Stop using lemmy-ui:dev images (#1880)
[lemmy.git] / docker / prod / deploy.sh
1 #!/bin/sh
2 #git checkout main
3
4 # Creating the new tag
5 new_tag="$1"
6 third_semver=$(echo $new_tag | cut -d "." -f 3)
7
8 # The ansible and docker installs should only update for non release-candidates
9 # IE, when the third semver is a number, not '2-rc'
10 if [ ! -z "${third_semver##*[!0-9]*}" ]; then
11   sed -i "s/dessalines\/lemmy:.*/dessalines\/lemmy:$new_tag/" ../prod/docker-compose.yml
12   sed -i "s/dessalines\/lemmy-ui:.*/dessalines\/lemmy-ui:$new_tag/" ../prod/docker-compose.yml
13   sed -i "s/dessalines\/lemmy-ui:.*/dessalines\/lemmy-ui:$new_tag/" ../dev/docker-compose.yml
14   sed -i "s/dessalines\/lemmy-ui:.*/dessalines\/lemmy-ui:$new_tag/" ../federation/docker-compose.yml
15   git add ../prod/docker-compose.yml
16
17   # Setting the version for Ansible
18   pushd ../../../lemmy-ansible
19   echo $new_tag > "VERSION"
20   git add "VERSION"
21   git commit -m"Updating VERSION"
22   git push
23   popd
24 fi
25
26 # Update crate versions for crates.io
27 pushd ../../
28 old_tag=$(head -3 Cargo.toml | tail -1 | cut -d'"' -f 2)
29 for crate in crates/*; do
30   pushd $crate
31   # update version of the crate itself (only first occurence)
32   # https://stackoverflow.com/a/9453461
33   sed -i "0,/version = \"$old_tag\"/s//version = \"$new_tag\"/g" Cargo.toml
34   # update version of lemmy dependencies
35   sed -i "s/{ version = \"=$old_tag\", path/{ version = \"=$new_tag\", path/g" Cargo.toml
36   git add Cargo.toml
37   popd
38 done
39 # same as above, for the main cargo.toml
40 sed -i "s/{ version = \"=$old_tag\", path/{ version = \"=$new_tag\", path/g" Cargo.toml
41 sed -i "s/version = \"$old_tag\"/version = \"$new_tag\"/g" Cargo.toml
42 git add Cargo.toml
43 cargo check
44 git add Cargo.lock
45 popd
46
47 # The commit
48 git commit -m"Version $new_tag"
49 git tag $new_tag
50
51 # export COMPOSE_DOCKER_CLI_BUILD=1
52 # export DOCKER_BUILDKIT=1
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