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