tangled
alpha
login
or
join now
regnault.dev
/
spindle-artifact
A cli tool to upload an artifact to a tangled repo, mainly during spindle workflows
ci
artifact
spindle
7
fork
atom
overview
issues
pulls
pipelines
Compare changes
Choose any two refs to compare.
base:
test
main
1.0.0
compare:
test
main
1.0.0
go
+103
-16
3 changed files
expand all
collapse all
unified
split
.tangled
workflows
next-tag.yml
release.yml
test.yml
+67
.tangled/workflows/next-tag.yml
···
1
1
+
when:
2
2
+
- event: ["push", "manual"]
3
3
+
branch: ["main"]
4
4
+
5
5
+
engine: nixery
6
6
+
7
7
+
dependencies:
8
8
+
nixpkgs:
9
9
+
- semver-tool
10
10
+
- openssh
11
11
+
- less
12
12
+
13
13
+
steps:
14
14
+
- name: Setup user
15
15
+
command: |
16
16
+
echo "root:x:0:0::$HOME:/usr/bin/bash" >> /etc/passwd
17
17
+
18
18
+
- name: Setup SSH
19
19
+
command: |
20
20
+
mkdir -p $HOME/.ssh
21
21
+
echo "-----BEGIN OPENSSH PRIVATE KEY-----" > $HOME/.ssh/privkey
22
22
+
printf $SSH_KEY >> $HOME/.ssh/privkey
23
23
+
echo "-----END OPENSSH PRIVATE KEY-----" >> $HOME/.ssh/privkey
24
24
+
chmod 600 $HOME/.ssh/privkey
25
25
+
ssh-keyscan -t rsa tangled.org >> $HOME/.ssh/known_hosts
26
26
+
27
27
+
- name: Setup SSH repo
28
28
+
command: |
29
29
+
git config --global user.email "evann.regnault@pm.me"
30
30
+
git config --global user.name "Evann Regnault"
31
31
+
git fetch
32
32
+
git checkout main
33
33
+
git pull --tags
34
34
+
URL=$(git remote get-url origin)
35
35
+
REPO=${URL#*//*/}
36
36
+
git remote set-url origin "git@tangled.org:"$REPO
37
37
+
38
38
+
- name: Next tag
39
39
+
command: |
40
40
+
TAG=$(git tag | tac | head -1)
41
41
+
42
42
+
if [ "$TAG" == "" ]; then
43
43
+
TAG="0.0.0"
44
44
+
fi
45
45
+
46
46
+
COMMIT=$(git log -1 --pretty=%B)
47
47
+
48
48
+
case "${COMMIT^^}" in
49
49
+
MAJOR*) TYPE="major" ;;
50
50
+
MINOR*) TYPE="minor" ;;
51
51
+
PATCH*) TYPE="patch" ;;
52
52
+
*) TYPE="" ;;
53
53
+
esac
54
54
+
55
55
+
if [ $TYPE ]; then
56
56
+
semver bump $TYPE $TAG > tag
57
57
+
fi
58
58
+
59
59
+
- name: Push new tag
60
60
+
environment:
61
61
+
GIT_SSH_COMMAND: "ssh -i $HOME/.ssh/privkey -o IdentitiesOnly=yes"
62
62
+
command: |
63
63
+
if [ -f "tag" ]; then
64
64
+
TAG=$(cat tag)
65
65
+
git tag -a $TAG -m "Release $TAG"
66
66
+
git push --tags
67
67
+
fi
+36
.tangled/workflows/release.yml
···
1
1
+
when:
2
2
+
- event: ["push"]
3
3
+
tag: ["*"]
4
4
+
5
5
+
engine: nixery
6
6
+
7
7
+
dependencies:
8
8
+
nixpkgs:
9
9
+
- go
10
10
+
- less
11
11
+
- gcc
12
12
+
13
13
+
# custom registry
14
14
+
git+https://tangled.org/regnault.dev/spindle-artifact:
15
15
+
- spindle-artifact
16
16
+
17
17
+
environment:
18
18
+
CGO_ENABLED: 1
19
19
+
20
20
+
steps:
21
21
+
- name: Setup git
22
22
+
command: |
23
23
+
git fetch
24
24
+
git checkout main
25
25
+
git pull --tags
26
26
+
27
27
+
- name: Build
28
28
+
command: |
29
29
+
TAG=$(git tag | tac | head -1)
30
30
+
go build .
31
31
+
mv spindle-artifact spindle-artifact-$TAG
32
32
+
33
33
+
- name: Upload artifact
34
34
+
command: |
35
35
+
TAG=$(git tag | tac | head -1)
36
36
+
~/.nix-profile/bin/spindle-artifact spindle-artifact $TAG spindle-artifact-$TAG
-16
.tangled/workflows/test.yml
···
1
1
-
when:
2
2
-
- event: ["push", "manual"]
3
3
-
branch: ["main"]
4
4
-
5
5
-
engine: nixery
6
6
-
7
7
-
dependencies:
8
8
-
# custom registry
9
9
-
git+https://tangled.org/regnault.dev/spindle-artifact:
10
10
-
- spindle-artifact
11
11
-
12
12
-
steps:
13
13
-
- name: Upload file
14
14
-
command: |
15
15
-
echo "a" > a.txt
16
16
-
~/.nix-profile/bin/spindle-artifact webfishing-macos-atproto 1.0 a.txt