Skip to content

Commit cbcf5ed

Browse files
committed
Build cli version
1 parent 4eff1e6 commit cbcf5ed

File tree

16 files changed

+132
-11
lines changed

16 files changed

+132
-11
lines changed

.github/workflows/release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,15 @@ jobs:
2121
- name: Build and archive
2222
run: build/ci/build.sh ${{ env.VERSION }}
2323

24+
- name: Build and archive (cli version)
25+
run: build/ci/cli-build.sh ${{ env.VERSION }}
26+
2427
- name: Build .deb package
2528
run: build/ci/build-deb.sh ${{ env.VERSION }}
2629

30+
- name: Build .deb package (cli version)
31+
run: build/ci/cli-build-deb.sh ${{ env.VERSION }}
32+
2733
- name: Upload the artifacts
2834
uses: skx/github-action-publish-binaries@master
2935
env:

.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION=0.1.0
1+
VERSION=0.1.1

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
# Change Log
33
All notable changes to this project will be documented in this file.
44

5+
## [0.1.1] - 2022-12-21
6+
### Added
7+
- Create config path if not exist
8+
- Separate cli-only version
9+
510
## [0.1.0] - 2022-12-20
611
### Added
712
- Binary release

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
[![Go Report Card](https://goreportcard.com/badge/github.com/aceberg/git-syr)](https://goreportcard.com/report/github.com/aceberg/git-syr)
2+
[![Binary-release](https://github.com/aceberg/git-syr/actions/workflows/release.yml/badge.svg)](https://github.com/aceberg/git-syr/actions/workflows/release.yml)
23

34
# git-syr
45

5-
Sync Your Repos
6+
Sync Your Repos - pull or push your git repos regularly. For dotfiles backups or note taking in git repo
7+
68

79
Work in progress..
810

build/ci/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ mkdir -p $PKGDIR
1111
cp git-syr $PKGDIR/
1212
cp configs/git-syr.service $PKGDIR/
1313
cp configs/git-syr@.service $PKGDIR/
14-
cp configs/user-install.sh $PKGDIR/
14+
cp configs/install.sh $PKGDIR/
1515

1616
cd /opt
1717
tar cvzf git-syr-$1.tar.gz git-syr

build/ci/cli-build-deb.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
PKGDIR=git-syr-cli-$1-0_all
4+
5+
umask 0022
6+
7+
mkdir -p $PKGDIR/usr/bin
8+
mkdir -p $PKGDIR/lib/systemd/system
9+
10+
cp configs/git-syr-cli.service $PKGDIR/lib/systemd/system/
11+
cp configs/git-syr-cli@.service $PKGDIR/lib/systemd/system/
12+
13+
cp git-syr-cli $PKGDIR/usr/bin/
14+
15+
mkdir -p $PKGDIR/DEBIAN
16+
17+
echo "Package: git-syr-cli
18+
Version: $1
19+
Section: utils
20+
Priority: optional
21+
Architecture: all
22+
Maintainer: aceberg <aceberg_a@proton.me>
23+
Description: Sync Your Repos - pull or push your git repos regularly
24+
" > $PKGDIR/DEBIAN/control
25+
26+
dpkg-deb --build --root-owner-group $PKGDIR
27+
28+
rm -rf $PKGDIR

build/ci/cli-build.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
cd cmd/git-syr-cli/ && CGO_ENABLED=0 go build -o ../../git-syr-cli .
4+
cd ../../
5+
6+
PKGDIR=/opt/git-syr-cli
7+
8+
umask 0022
9+
10+
mkdir -p $PKGDIR
11+
cp git-syr-cli $PKGDIR/
12+
cp configs/git-syr-cli.service $PKGDIR/
13+
cp configs/git-syr-cli@.service $PKGDIR/
14+
cp configs/cli-install.sh $PKGDIR/
15+
16+
cd /opt
17+
tar cvzf git-syr-cli-$1.tar.gz git-syr-cli
18+
cd -
19+
cp /opt/git-syr-cli-$1.tar.gz .

cmd/git-syr-cli/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"time"
66
// "log"
77

8+
"github.com/aceberg/git-syr/internal/check"
89
"github.com/aceberg/git-syr/internal/cli"
910
"github.com/aceberg/git-syr/internal/logfile"
1011
)
@@ -17,6 +18,9 @@ func main() {
1718
yamlPtr := flag.String("r", yamlPath, "Path to repos yaml file")
1819
flag.Parse()
1920

21+
check.Path(*logPtr)
22+
check.Path(*yamlPtr)
23+
2024
go logfile.Output(*logPtr)
2125
time.Sleep(1 * time.Second)
2226

cmd/git-syr/main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"time"
66
// "log"
77

8+
"github.com/aceberg/git-syr/internal/check"
89
"github.com/aceberg/git-syr/internal/cli"
910
"github.com/aceberg/git-syr/internal/logfile"
1011
"github.com/aceberg/git-syr/internal/web"
@@ -21,6 +22,10 @@ func main() {
2122
webPtr := flag.Bool("w", true, "Launch without web gui")
2223
flag.Parse()
2324

25+
check.Path(*confPtr)
26+
check.Path(*logPtr)
27+
check.Path(*yamlPtr)
28+
2429
go logfile.Output(*logPtr)
2530
time.Sleep(1 * time.Second)
2631

configs/cli-install.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
3+
cp git-syr-cli /usr/bin/
4+
cp git-syr-cli.service /lib/systemd/system/
5+
cp git-syr-cli@.service /lib/systemd/system/

0 commit comments

Comments
 (0)