Skip to content

Commit 6dc4220

Browse files
👷 Updated CI/CD to publish binaries to winget/snapcraft
1 parent 44656b1 commit 6dc4220

File tree

4 files changed

+135
-47
lines changed

4 files changed

+135
-47
lines changed

.github/workflows/create_release.yml

Lines changed: 109 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ name: Release (Multiple Arch)
22

33
on:
44
push:
5-
branches: [ prod ]
5+
tags:
6+
- "*"
67
workflow_dispatch:
78

89
jobs:
910
build_release:
11+
name: Run Make Build
1012
permissions: write-all
1113
runs-on: ubuntu-latest
1214
steps:
@@ -15,6 +17,16 @@ jobs:
1517
with:
1618
fetch-depth: 0
1719

20+
- name: Cache Go Modules
21+
uses: actions/cache@v4
22+
with:
23+
path: |
24+
~/go/pkg/mod
25+
~/.cache/go-build
26+
key: go-mod-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
27+
restore-keys: |
28+
go-mod-${{ runner.os }}-
29+
1830
- name: Run Make
1931
run: make BUILD_TYPE=RELEASE
2032

@@ -30,13 +42,22 @@ jobs:
3042
build_win_installer:
3143
needs: build_release
3244
runs-on: windows-latest
45+
name: Build Windows Installer (INNO)
3346
permissions: write-all
3447
steps:
3548
- name: Checkout
3649
uses: actions/checkout@v4
3750
with:
3851
fetch-depth: 0
3952

53+
- name: Read Version
54+
id: read_version
55+
shell: pwsh
56+
run: |
57+
$TAG = git describe --tags --abbrev=0
58+
echo "Current tag: $TAG"
59+
echo "V_TAG=$TAG" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
60+
4061
- name: Download Artifact
4162
uses: actions/download-artifact@v4
4263
with:
@@ -46,17 +67,23 @@ jobs:
4667

4768
- name: Rename Binary
4869
shell: cmd
49-
run: ren build\chibi_windows.exe chibi.exe
70+
run: ren build\chibi_${{ env.V_TAG }}_win_amd64.exe chibi.exe
5071

5172
- name: Pack Installer
5273
uses: Minionguyjpro/[email protected]
74+
env:
75+
V_TAG: ${{ env.V_TAG }}
5376
with:
5477
path: installer_scripts\chibi_setup.iss
5578
options: /O+
5679

5780
- name: Move installer to build dir
5881
shell: cmd
59-
run: move installer_scripts\Output\chibi_installer.exe build\
82+
run: move installer_scripts\Output\chibi_${{ env.V_TAG }}_installer.exe build\
83+
84+
- name: Rename Binary (Again)
85+
shell: cmd
86+
run: ren build\chibi.exe chibi_${{ env.V_TAG }}_win_amd64.exe
6087

6188
- name: Upload Installer Artifacts
6289
uses: actions/upload-artifact@v4
@@ -65,6 +92,7 @@ jobs:
6592
path: build
6693

6794
create_release:
95+
name: Publish new Release
6896
needs: build_win_installer
6997
permissions: write-all
7098
runs-on: ubuntu-latest
@@ -109,4 +137,81 @@ jobs:
109137
with:
110138
repo-token: ${{ secrets.GITHUB_TOKEN }}
111139
release-tag: ${{ env.tag }}
112-
files: "build/*"
140+
files: "build/*"
141+
142+
publish_to_winget:
143+
needs: create_release
144+
permissions: write-all
145+
runs-on: windows-latest
146+
name: Publish installer to WinGet
147+
steps:
148+
- name: Checkout
149+
uses: actions/checkout@v4
150+
with:
151+
fetch-depth: 0
152+
153+
- name: Publish to WinGet
154+
uses: vedantmgoyal9/winget-releaser@main
155+
with:
156+
identifier: CosmicPredator.Chibi
157+
installers-regex: '.*_installer\.exe$'
158+
token: ${{ secrets.WINGET_TOKEN }}
159+
160+
publish_to_snap_store:
161+
needs: create_release
162+
runs-on: ubuntu-latest
163+
name: Publish to Snap Store
164+
steps:
165+
- name: Checkout
166+
uses: actions/checkout@v4
167+
with:
168+
fetch-depth: 0
169+
170+
- name: Read Tag
171+
id: read_version
172+
run: |
173+
TAG=$(git describe --tags --abbrev=0)
174+
echo "Current tag: $TAG"
175+
echo "tag=$TAG" >> $GITHUB_ENV
176+
177+
- name: Download Artifact
178+
uses: actions/download-artifact@v4
179+
with:
180+
name: build_artifacts_with_installer
181+
github-token: ${{ secrets.GITHUB_TOKEN }}
182+
path: build/
183+
184+
- name: Rename Linux Binary
185+
run: |
186+
mv build/chibi_${{ env.tag }}_linux_amd64 build/chibi
187+
sudo chmod 777 build/chibi
188+
echo "Rename binary successful"
189+
190+
- name: Move snapcraft.yaml file to root
191+
run: |
192+
mv installer_scripts/snapcraft.yaml snapcraft.yaml
193+
echo "version: ${{ env.tag }}" >> snapcraft.yaml
194+
195+
- name: Install Snapcraft
196+
run: |
197+
sudo snap install snapcraft --classic
198+
199+
- name: Setup LXD
200+
uses: canonical/setup-lxd@main
201+
with:
202+
group: lxd
203+
204+
- name: Build snap
205+
run: |
206+
sudo usermod -a -G lxd $USER
207+
sudo snapcraft
208+
209+
- name: Upload snap to Snap Store
210+
env:
211+
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
212+
run: |
213+
sudo snap install snapcraft --classic
214+
snapcraft upload *.snap --release=candidate
215+
216+
217+

CHANGELOG.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
### ✨ What's New
2-
- The `ls` command now shows Rewatching/Rereading Media along with Current Media. The Rewatching/Rereading media will be marked by **"(R)"** before the media title.
3-
- You can now pass incremental or decremental progress to `update` command. For example,
2+
- Chibi is now available in Snap Store for Linux users. To install chibi, run
3+
```shell
4+
sudo snap install chibi
5+
- Added Loading indicator to all API Requests.
6+
- Added `chibi logout` command to log you out from AniList.
7+
- Start Date is automatically added when `chibi add` command in invoked and `status` flag is set to `watching`.
8+
- `chibi update` command now supports 2 new flags,
9+
- `-n "<note>"` for entry notes.
10+
- `-r <score>` for entry score.
411

5-
To increment progress of a media by 2,
6-
```shell
7-
$ chibi update 8861 -p +2
8-
```
9-
10-
To decrement progress of a media by 5,
11-
```shell
12-
$ chibi update 8861 -p -5
13-
```
12+
### ✨ Other Changes
13+
- Migrated from JSON file storage to Sqlite3 storage for configurations.
14+
- Complete Architecture change for faster response.
15+
- Added Code Comments in missing areas
1416

1517
### 🐛 Bug Fixes
16-
- None for now 👽️
18+
- Fixed a bad `if` check when handling start date. (085fff237d04fde01e6b19d96078af2030ab1bbb)
19+
- Fixed app exiting with weird error messages.
20+
- Fixed "WinGet not detecting app version". This change will take effect when installing upcoming versions of chibi.
21+
22+
Thanks @mist8kengas for the contributions ☺️.

Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ else
1313
LDFLAGS:="-X 'main.VERSION=${LATEST_TAG}'"
1414
endif
1515

16-
LINUX_BIN=${BINARY_NAME}_linux_amd64
17-
WIN_BIN=${BINARY_NAME}_windows.exe
18-
APPLE_INTEL_BIN=${BINARY_NAME}_darwin_amd64
19-
APPLE_SILICON_BIN=${BINARY_NAME}_darwin_arm64
16+
LINUX_BIN=${BINARY_NAME}_${LATEST_TAG}_linux_amd64
17+
WIN_BIN=${BINARY_NAME}_${LATEST_TAG}_win_amd64.exe
18+
WIN_ARM_BIN=${BINARY_NAME}_${LATEST_TAG}_win_arm64.exe
19+
APPLE_INTEL_BIN=${BINARY_NAME}_${LATEST_TAG}_darwin_amd64
20+
APPLE_SILICON_BIN=${BINARY_NAME}_${LATEST_TAG}_darwin_arm64
2021

2122
.PHONY: all
2223

@@ -31,6 +32,7 @@ compile:
3132
GOARCH=amd64 GOOS=darwin go build -ldflags=${LDFLAGS} -o ${BUILD_DIR}/${APPLE_INTEL_BIN}
3233
GOARCH=arm64 GOOS=darwin go build -ldflags=${LDFLAGS} -o ${BUILD_DIR}/${APPLE_SILICON_BIN}
3334
GOARCH=amd64 GOOS=windows go build -ldflags=${LDFLAGS} -o ${BUILD_DIR}/${WIN_BIN}
35+
GOARCH=arm64 GOOS=windows go build -ldflags=${LDFLAGS} -o ${BUILD_DIR}/${WIN_ARM_BIN}
3436
GOARCH=amd64 GOOS=linux go build -ldflags=${LDFLAGS} -o ${BUILD_DIR}/${LINUX_BIN}
3537

3638
#TODO: Implement dynamic versioning

cmd/cmd_update.go

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cmd
22

33
import (
4+
"errors"
45
"fmt"
56
"strconv"
67

@@ -9,45 +10,19 @@ import (
910
"github.com/spf13/cobra"
1011
)
1112

12-
// // TODO: Update progress relatively. For example "+2", "-10" etc.,
1313
var progress string
1414
var updateStatus string
1515
var notes string
1616
var scoreString string
1717

18-
// func handleUpdate(mediaId int) {
19-
// CheckIfTokenExists()
20-
21-
// progressInt, err := strconv.Atoi(progress)
22-
// if err == nil {
23-
// if progressInt == 0 {
24-
// fmt.Println(
25-
// ERROR_MESSAGE_TEMPLATE.Render("The flag 'progress' should be greater than 0."),
26-
// )
27-
// }
28-
// }
29-
30-
// mediaUpdate := internal.NewMediaUpdate()
31-
// err = mediaUpdate.Get(false, mediaId, progress, "", "")
32-
33-
// if err != nil {
34-
// ErrorMessage(err.Error())
35-
// }
36-
// fmt.Println(
37-
// SUCCESS_MESSAGE_TEMPLATE.Render(
38-
// "Done ✅",
39-
// ),
40-
// )
41-
// }
42-
4318
func handleUpdate(cmd *cobra.Command, args []string) {
4419
if len(args) == 2 {
4520
progress = args[1]
4621
}
4722
id, err := strconv.Atoi(args[0])
4823
if err != nil {
4924
fmt.Println(
50-
ERROR_MESSAGE_TEMPLATE.Render("Invalid media id. please provide a valid one..."),
25+
ui.ErrorText(errors.New("invalid media id. please provide a valid one")),
5126
)
5227
}
5328

0 commit comments

Comments
 (0)