~romuloalves/crypt-transfer

crypt-transfer/.build.yml -rw-r--r-- 2.3 KiB
e4596ffb — romuloalves Adds Gitlab to known_hosts during build 5 months ago
                                                                                
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
artifacts:
        - crypt-transfer-releases/v0.1.0.zip
environment:
        project: crypt-transfer
        releases: crypt-transfer-releases
        version: v0.1.0
image: alpine/edge
packages:
        - go
        - docker
        - zip
        - git
secrets:
        - d1a642c5-ae16-4487-be09-744d1b263255
shell: true
sources:
        - https://git.sr.ht/~romuloalves/crypt-transfer
        - git@gitlab.com:romuloalves/crypt-transfer-releases.git
tasks:
        - deps: |
                  # Downloads/installs the dependencies

                  # Go
                  go get github.com/karalabe/xgo

                  # Docker
                  # https://todo.sr.ht/~sircmpwn/builds.sr.ht/223
                  sudo service cgroups start
                  sudo nohup dockerd --bip 172.18.0.1/16 </dev/null >/dev/null 2>&1 &
                  sleep 10
                  sudo addgroup $USER docker

        - build: |
                  # Builds the executables

                  export GOPATH=$HOME/go

                  # Moves project to $GOPATH
                  mkdir --parents go/src/git.sr.ht/romuloalves
                  cp -R ${project} go/src/git.sr.ht/romuloalves/${project}

                  cd go/src/git.sr.ht/romuloalves/${project}

                  # Builds
                  mkdir -p dist
                  ~/go/bin/xgo -out dist/crypt-transfer-${version} --targets=linux/*,windows/*,darwin/* .

        - compress: |
                  # Compresses the artifacts into a zip

                  folder="crypt-transfer-${version}"
                  cd go/src/git.sr.ht/romuloalves/${project}
                  mv dist $folder
                  zip -r $HOME/${releases}/${version}.zip $folder

        - deploy: |
                  # Adds the zip to the release repo on GitLab

                  # Adds Gitlab to SSH known_hosts
                  ssh-keyscan -H gitlab.com >> ~/.ssh/known_hosts

                  # Sets git user config
                  git config --global user.name "sourcehut builds"
                  git config --global user.email builds@sr.ht

                  # Adds zip to repo
                  cd ${releases}
                  git add .
                  git commit -m "Releases ${version}"
                  git push origin master -f

triggers:
        - action: email
          condition: always
          to: romuloalves <me@romuloalves.dev>