feat(ci): added release workflow
This commit is contained in:
parent
2bfcff6a18
commit
a1ee2b7e61
4 changed files with 62 additions and 3 deletions
|
@ -10,15 +10,19 @@ jobs:
|
|||
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
|
||||
with:
|
||||
go-version-file: '/workdir/go.mod'
|
||||
check-latest: true
|
||||
cache-dependency-path: "/workdir/**/*.sum"
|
||||
|
||||
- run: go build
|
||||
working-directory: /workdir
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: fj
|
||||
name: fj.zip
|
||||
path: /workdir/fj
|
||||
|
|
51
.forgejo/workflows/release.yml
Normal file
51
.forgejo/workflows/release.yml
Normal file
|
@ -0,0 +1,51 @@
|
|||
on:
|
||||
push:
|
||||
tags: 'v*'
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- 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
|
||||
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
|
||||
|
||||
- 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: release
|
||||
token: ${{ github.token }}
|
||||
override: ${{ vars.OVERRIDE || "false" }}
|
||||
verbose: ${{ vars.VERBOSE || "false" }}
|
||||
hide-archive-link: true
|
||||
release-notes-assistant: true
|
|
@ -1,7 +1,8 @@
|
|||
<img src="logo.png" width="300" height="300" alt="Ferret Junior, the mascot of software project 'FJ', a command line tool to interface with the forgejo git forge. A young ferret standing on two legs, smiling, with a shirt saying 'FJ' in reddish brown letters, computers in the ground. Logo, white background, cut out, not realistic." />
|
||||
<br>
|
||||
|
||||
# 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.
|
||||
Environment variables take precedence over values in the .env file.
|
||||
|
|
3
fj.go
3
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 <command> [arguments]")
|
||||
fmt.Println("\nAvailable Commands:")
|
||||
|
|
Loading…
Add table
Reference in a new issue