tangled
alpha
login
or
join now
regnault.dev
/
spindle-artifact
7
fork
atom
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
Major : first release
regnault.dev
3 months ago
4b160449
23b5501c
0/1
next-tag.yml
failed
7s
+88
-16
3 changed files
expand all
collapse all
unified
split
.tangled
workflows
next-tag.yml
release.yml
test.yml
+62
.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
+
12
12
+
steps:
13
13
+
- name: Setup user
14
14
+
command: |
15
15
+
echo "root:x:0:0::$HOME:/usr/bin/bash" >> /etc/passwd
16
16
+
17
17
+
- name: Setup SSH
18
18
+
command: |
19
19
+
mkdir -p $HOME/.ssh
20
20
+
echo "-----BEGIN OPENSSH PRIVATE KEY-----" > $HOME/.ssh/privkey
21
21
+
echo $SSH_KEY >> $HOME/.ssh/privkey
22
22
+
echo "-----END OPENSSH PRIVATE KEY-----" >> $HOME/.ssh/privkey
23
23
+
chmod 600 $HOME/.ssh/privkey
24
24
+
25
25
+
- name: Setup SSH repo
26
26
+
command: |
27
27
+
git config --global user.email "evann.regnault@pm.me"
28
28
+
git config --global user.name "Evann Regnault"
29
29
+
URL=$(git remote get-url origin)
30
30
+
REPO=${URL#*//*/}
31
31
+
git remote set-url origin "git@tangled.org:"$REPO
32
32
+
33
33
+
- name: Next tag
34
34
+
command: |
35
35
+
TAG=$(git tag | tac | head -1)
36
36
+
37
37
+
if [ "$TAG" == "" ]; then
38
38
+
TAG="0.0.0"
39
39
+
fi
40
40
+
41
41
+
COMMIT=$(git log -1 --pretty=%B)
42
42
+
43
43
+
case "${COMMIT^^}" in
44
44
+
MAJOR*) TYPE="major" ;;
45
45
+
MINOR*) TYPE="minor" ;;
46
46
+
PATCH*) TYPE="patch" ;;
47
47
+
*) TYPE="" ;;
48
48
+
esac
49
49
+
50
50
+
if [ $TYPE != "" ]; then
51
51
+
semver bump $TYPE $TAG > tag
52
52
+
fi
53
53
+
54
54
+
- name: Push new tag
55
55
+
environment:
56
56
+
GIT_SSH_COMMAND: "ssh -i $HOME/.ssh/privkey -o IdentitiesOnly=yes"
57
57
+
command: |
58
58
+
if [ -f "tag" ]; then
59
59
+
TAG=$(cat tag)
60
60
+
git tag -a $TAG -m "Release $TAG"
61
61
+
git push --tags
62
62
+
fi
+26
.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
+
- semver-tool
11
11
+
12
12
+
# custom registry
13
13
+
git+https://tangled.org/regnault.dev/spindle-artifact:
14
14
+
- spindle-artifact
15
15
+
16
16
+
steps:
17
17
+
- name: Build
18
18
+
command: |
19
19
+
TAG=$(git tag | tac | head -1)
20
20
+
go build .
21
21
+
mv spindle-artifact spindle-artifact-$TAG
22
22
+
23
23
+
- name: Upload artifact
24
24
+
command: |
25
25
+
TAG=$(git tag | tac | head -1)
26
26
+
~/.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