diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml
index 6f73a5b..f0b3e47 100644
--- a/.forgejo/workflows/build.yml
+++ b/.forgejo/workflows/build.yml
@@ -3,22 +3,31 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- - run: |
+ - name: Setup SSH
+ run: |
mkdir ~/.ssh
chmod 700 ~/.ssh
echo "${{ secrets.ALTAIR_SSH_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -p 999 tehga.me >> ~/.ssh/known_hosts
ssh-keyscan -p 999 doradus.tehga.me >> ~/.ssh/known_hosts
- - run: git clone --depth 1 ssh://gitea@tehga.me:999/wasp/fj.git --branch main --single-branch /workdir
- - uses: actions/setup-go@v5
+
+ - name: Checkout
+ run: git clone --depth 1 ssh://gitea@tehga.me:999/wasp/fj.git --branch main --single-branch /workdir
+
+ - name: Setup Go
+ uses: actions/setup-go@v5
with:
go-version-file: '/workdir/go.mod'
check-latest: true
cache-dependency-path: "/workdir/**/*.sum"
- - run: go build
+
+ - name: Build
+ run: go build
working-directory: /workdir
- - uses: actions/upload-artifact@v3
+
+ - name: Upload artifact
+ uses: actions/upload-artifact@v3
with:
- name: fj
+ name: fj.zip
path: /workdir/fj
diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml
new file mode 100644
index 0000000..36f3a10
--- /dev/null
+++ b/.forgejo/workflows/release.yml
@@ -0,0 +1,55 @@
+on:
+ push:
+ tags: 'v*'
+
+jobs:
+ publish:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Setup SSH
+ run: |
+ mkdir ~/.ssh
+ chmod 700 ~/.ssh
+ echo "${{ secrets.ALTAIR_SSH_KEY }}" > ~/.ssh/id_ed25519
+ chmod 600 ~/.ssh/id_ed25519
+ ssh-keyscan -p 999 tehga.me >> ~/.ssh/known_hosts
+ ssh-keyscan -p 999 doradus.tehga.me >> ~/.ssh/known_hosts
+
+ - name: Checkout
+ run: git clone --depth 1 ssh://gitea@tehga.me:999/wasp/fj.git --branch main --single-branch /workdir
+
+ - name: Setup Go
+ uses: actions/setup-go@v5
+ with:
+ go-version-file: '/workdir/go.mod'
+ check-latest: true
+ cache-dependency-path: "/workdir/**/*.sum"
+
+ - name: Apt install curl jq make
+ run: |
+ export DEBIAN_FRONTEND=noninteractive
+ apt-get update -qq
+ apt-get -q install -y -qq curl jq make
+
+ - name: Build release
+ run: |
+ version="${{ github.ref_name }}"
+ mkdir release
+ go build -ldflags "-extldflags -static -s -w -X \"main.Version=${version##*v}\""
+ cp -a /workdir/fj release/fj
+ working-directory: /workdir
+
+ - name: Publish release
+ uses: https://code.forgejo.org/actions/forgejo-release@v2.5.1
+ with:
+ url: "https://tehga.me/forgejo/"
+ repo: "${{ github.repository }}"
+ direction: upload
+ tag: "${{ github.ref_name }}"
+ sha: "${{ github.sha }}"
+ release-dir: /workdir/release
+ token: ${{ github.token }}
+ override: ${{ vars.OVERRIDE || "false" }}
+ verbose: ${{ vars.VERBOSE || "false" }}
+ hide-archive-link: true
+ release-notes-assistant: true
diff --git a/README.md b/README.md
index ee8ca84..f51925b 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,8 @@
-# A Forgejo CLI - "gh for Forgejo"
+# Ferret Junior - A Forgejo CLI
+## "`gh` for Forgejo"
## Configuration
@@ -18,4 +19,4 @@ Required variables:
- `FJ_SSH_KEY_PATH`: Path to your SSH key
- `FJ_SSH_USER`: SSH user for your Forgejo instance
-Environment variables take precedence over values in the .env file.
\ No newline at end of file
+Environment variables take precedence over values in the .env file.
diff --git a/fj.go b/fj.go
index 7602b77..8e1c852 100644
--- a/fj.go
+++ b/fj.go
@@ -16,6 +16,8 @@ import (
"github.com/go-git/go-git/v5/plumbing/transport/ssh"
)
+var Version = "dev"
+
type ForgejoRepository struct {
ID int `json:"id"`
Name string `json:"name"`
@@ -34,6 +36,7 @@ const (
func showHelp() {
fmt.Println("fj - A Forgejo CLI")
+ fmt.Println("Version:", Version)
fmt.Println("\nUsage:")
fmt.Println(" fj [arguments]")
fmt.Println("\nAvailable Commands:")