]> Untitled Git - lemmy.git/blob - scripts/release.sh
Merge branch 'main' of https://github.com/LemmyNet/lemmy
[lemmy.git] / scripts / release.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 # The ansible and docker installs should only update for non release-candidates
10 # IE, when the third semver is a number, not '2-rc'
11 if [ ! -z "${third_semver##*[!0-9]*}" ]; then
12   pushd ../docker/prod/
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   popd
21
22   # Setting the version for Ansible
23   pushd ../../../lemmy-ansible
24   echo $new_tag > "VERSION"
25   git add "VERSION"
26   git commit -m"Updating VERSION"
27   git tag $new_tag
28   git push origin $new_tag
29   git push
30   popd
31 fi
32
33 # Update crate versions
34 pushd ..
35 old_tag=$(grep version Cargo.toml | head -1 | cut -d'"' -f 2)
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