]> Untitled Git - lemmy.git/blob - docker/prod/deploy.sh
Fix prod deploy script and clippy (#1724)
[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   git add ../prod/docker-compose.yml
14
15   # Setting the version for Ansible
16   pushd ../../
17   echo $new_tag > "ansible/VERSION"
18   git add "ansible/VERSION"
19   popd
20 fi
21
22 # Update crate versions for crates.io
23 pushd ../../
24 old_tag=$(head -3 Cargo.toml | tail -1 | cut -d'"' -f 2)
25 for crate in crates/*; do
26   pushd $crate
27   # update version of the crate itself (only first occurence)
28   # https://stackoverflow.com/a/9453461
29   sed -i "0,/version = \"$old_tag\"/s//version = \"$new_tag\"/g" Cargo.toml
30   # update version of lemmy dependencies
31   sed -i "s/{ version = \"=$old_tag\", path/{ version = \"=$new_tag\", path/g" Cargo.toml
32   git add Cargo.toml
33   popd
34 done
35 # same as above, for the main cargo.toml
36 sed -i "s/{ version = \"=$old_tag\", path/{ version = \"=$new_tag\", path/g" Cargo.toml
37 sed -i "s/version = \"$old_tag\"/version = \"$new_tag\"/g" Cargo.toml
38 git add Cargo.toml
39 cargo check
40 git add Cargo.lock
41 popd
42
43 # The commit
44 git commit -m"Version $new_tag"
45 git tag $new_tag
46
47 # export COMPOSE_DOCKER_CLI_BUILD=1
48 # export DOCKER_BUILDKIT=1
49
50 # Push
51 git push origin $new_tag
52 git push
53
54 # Pushing to any ansible deploys
55 # cd ../../../lemmy-ansible || exit
56 # ansible-playbook -i prod playbooks/site.yml --vault-password-file vault_pass