forked from RocketChat/Rocket.Chat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
snap.sh
40 lines (28 loc) · 1.29 KB
/
snap.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
set -euvo pipefail
IFS=$'\n\t'
# Add launchpad to known hosts
mkdir -p $HOME/.ssh
ssh-keyscan -t rsa -H git.launchpad.net >> $HOME/.ssh/known_hosts
echo "Preparing to trigger a snap release for $SNAP_CHANNEL channel"
cd $PWD/.snapcraft
# We need some meta data so it'll actually commit. This could be useful to have for debugging later.
echo -e "Tag: $CIRCLE_TAG\r\nBranch: $CIRCLE_BRANCH\r\nBuild: $CIRCLE_BUILD_NUM\r\nCommit: $CIRCLE_SHA1" > buildinfo
# Clone launchpad repo for the channel down.
git clone -b $SNAP_CHANNEL --depth 1 git+ssh://[email protected]/rocket.chat launchpad
# Rarely will change, but just incase we copy it all
cp -r resources buildinfo snap launchpad/
sed s/#{RC_VERSION}/$RC_VERSION/ snap/snapcraft.yaml > launchpad/snap/snapcraft.yaml
sed s/#{RC_VERSION}/$RC_VERSION/ resources/prepareRocketChat > launchpad/resources/prepareRocketChat
cd launchpad
git add resources snap buildinfo
# Set commit author details
git config user.email "[email protected]"
git config user.name "CircleCI"
# Another place where basic meta data will live for at a glance info
git commit -m "CircleCI Build: $CIRCLE_BUILD_NUM CircleCI Commit: $CIRCLE_SHA1"
# Push up up to the branch of choice.
git push origin $SNAP_CHANNEL
# Clean up
cd ..
rm -rf launchpad