+67
.tangled/workflows/next-tag.yml
+67
.tangled/workflows/next-tag.yml
···
1
+
when:
2
+
- event: ["push", "manual"]
3
+
branch: ["main"]
4
+
5
+
engine: nixery
6
+
7
+
dependencies:
8
+
nixpkgs:
9
+
- semver-tool
10
+
- openssh
11
+
- less
12
+
13
+
steps:
14
+
- name: Setup user
15
+
command: |
16
+
echo "root:x:0:0::$HOME:/usr/bin/bash" >> /etc/passwd
17
+
18
+
- name: Setup SSH
19
+
command: |
20
+
mkdir -p $HOME/.ssh
21
+
echo "-----BEGIN OPENSSH PRIVATE KEY-----" > $HOME/.ssh/privkey
22
+
printf $SSH_KEY >> $HOME/.ssh/privkey
23
+
echo "-----END OPENSSH PRIVATE KEY-----" >> $HOME/.ssh/privkey
24
+
chmod 600 $HOME/.ssh/privkey
25
+
ssh-keyscan -t rsa tangled.org >> $HOME/.ssh/known_hosts
26
+
27
+
- name: Setup SSH repo
28
+
command: |
29
+
git config --global user.email "evann.regnault@pm.me"
30
+
git config --global user.name "Evann Regnault"
31
+
git fetch
32
+
git checkout main
33
+
git pull --tags
34
+
URL=$(git remote get-url origin)
35
+
REPO=${URL#*//*/}
36
+
git remote set-url origin "git@tangled.org:"$REPO
37
+
38
+
- name: Next tag
39
+
command: |
40
+
TAG=$(git tag | tac | head -1)
41
+
42
+
if [ "$TAG" == "" ]; then
43
+
TAG="0.0.0"
44
+
fi
45
+
46
+
COMMIT=$(git log -1 --pretty=%B)
47
+
48
+
case "${COMMIT^^}" in
49
+
MAJOR*) TYPE="major" ;;
50
+
MINOR*) TYPE="minor" ;;
51
+
PATCH*) TYPE="patch" ;;
52
+
*) TYPE="" ;;
53
+
esac
54
+
55
+
if [ $TYPE ]; then
56
+
semver bump $TYPE $TAG > tag
57
+
fi
58
+
59
+
- name: Push new tag
60
+
environment:
61
+
GIT_SSH_COMMAND: "ssh -i $HOME/.ssh/privkey -o IdentitiesOnly=yes"
62
+
command: |
63
+
if [ -f "tag" ]; then
64
+
TAG=$(cat tag)
65
+
git tag -a $TAG -m "Release $TAG"
66
+
git push --tags
67
+
fi
+36
.tangled/workflows/release.yml
+36
.tangled/workflows/release.yml
···
1
+
when:
2
+
- event: ["push"]
3
+
tag: ["*"]
4
+
5
+
engine: nixery
6
+
7
+
dependencies:
8
+
nixpkgs:
9
+
- go
10
+
- less
11
+
- gcc
12
+
13
+
# custom registry
14
+
git+https://tangled.org/regnault.dev/spindle-artifact:
15
+
- spindle-artifact
16
+
17
+
environment:
18
+
CGO_ENABLED: 1
19
+
20
+
steps:
21
+
- name: Setup git
22
+
command: |
23
+
git fetch
24
+
git checkout main
25
+
git pull --tags
26
+
27
+
- name: Build
28
+
command: |
29
+
TAG=$(git tag | tac | head -1)
30
+
go build .
31
+
mv spindle-artifact spindle-artifact-$TAG
32
+
33
+
- name: Upload artifact
34
+
command: |
35
+
TAG=$(git tag | tac | head -1)
36
+
~/.nix-profile/bin/spindle-artifact spindle-artifact $TAG spindle-artifact-$TAG
+22
README.md
+22
README.md
···
1
+
# Spindle Artifact
2
+
3
+
## Configuration
4
+
5
+
In order to use the program you need to have two secrets
6
+
7
+
- `ATPROTO_HANDLE`: The handle of the owner of the repo
8
+
- `ATPROTO_APP_PASSWORD`: An App Password for the accounts
9
+
10
+
## Usage
11
+
12
+
```yaml
13
+
dependencies:
14
+
# custom registry
15
+
git+https://tangled.org/regnault.dev/spindle-artifact:
16
+
- spindle-artifact
17
+
18
+
steps:
19
+
- name: Upload file
20
+
command: |
21
+
~/.nix-profile/bin/spindle-artifact [repo] [tag] [file]
22
+
```
+10
-8
flake.lock
+10
-8
flake.lock
···
2
2
"nodes": {
3
3
"nixpkgs": {
4
4
"locked": {
5
-
"lastModified": 1758035966,
6
-
"narHash": "sha256-qqIJ3yxPiB0ZQTT9//nFGQYn8X/PBoJbofA7hRKZnmE=",
7
-
"rev": "8d4ddb19d03c65a36ad8d189d001dc32ffb0306b",
8
-
"revCount": 862643,
9
-
"type": "tarball",
10
-
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.862643%2Brev-8d4ddb19d03c65a36ad8d189d001dc32ffb0306b/01995b50-95e4-7d71-b9c1-6826ce5699df/source.tar.gz"
5
+
"lastModified": 1765779637,
6
+
"narHash": "sha256-KJ2wa/BLSrTqDjbfyNx70ov/HdgNBCBBSQP3BIzKnv4=",
7
+
"owner": "nixos",
8
+
"repo": "nixpkgs",
9
+
"rev": "1306659b587dc277866c7b69eb97e5f07864d8c4",
10
+
"type": "github"
11
11
},
12
12
"original": {
13
-
"type": "tarball",
14
-
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.1"
13
+
"owner": "nixos",
14
+
"ref": "nixos-unstable",
15
+
"repo": "nixpkgs",
16
+
"type": "github"
15
17
}
16
18
},
17
19
"root": {
+6
-2
flake.nix
+6
-2
flake.nix
···
2
2
description = "Go example flake for Zero to Nix";
3
3
4
4
inputs = {
5
-
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1";
5
+
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
6
6
};
7
7
8
8
outputs =
···
30
30
packages = forAllSystems (
31
31
{ pkgs }:
32
32
{
33
-
default = pkgs.buildGoModule {
33
+
spindle-artifact = pkgs.buildGoModule {
34
34
name = "spindle-artifact";
35
35
src = self;
36
36
vendorHash = "sha256-Z1LxWHlFbVEXWXt+73lu6yMCXnJD/JhpVq/8AaE+08s=";
37
37
goSum = ./go.sum;
38
+
39
+
prePatch = ''
40
+
export HOME=$TMPDIR
41
+
'';
38
42
};
39
43
}
40
44
);