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