Skip to content

Commit

Permalink
Added goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
pierreavn committed Dec 27, 2024
1 parent 9932650 commit 931e62f
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 24 deletions.
30 changes: 19 additions & 11 deletions .github/workflows/build-release-binary.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
name: Build and Release binary
name: Build and release binary

on:
schedule:
- cron: "30 1 * * *"
push:
tags:
- '*'

jobs:
build-release-binary:
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

- name: Build Verdex binary
run: |
go mod download
go build -ldflags "-X github.com/verdexlab/verdex/verdex/core.releaseEnvironment=release-binary" -o verdex-binary
- name: Setup Go environment
uses: actions/setup-go@v5

- name: Store Verdex binary
run: |
# TODO
- name: Build and release binary
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: '~> v2'
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25 changes: 25 additions & 0 deletions .github/workflows/create-cli-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Create CLI release

on:
workflow_dispatch:

jobs:
create-cli-release:
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Determine release version
run: echo "VERDEX_VERSION=$(awk '/cliVersion/{print $4}' verdex/core/config.go | sed -e 's/\"//g')" >> $GITHUB_ENV

- name: Create tag
run: |
git config user.name github-actions
git config user.email [email protected]
git tag "v$VERDEX_VERSION"
git push --tags
19 changes: 13 additions & 6 deletions .github/workflows/update-products-votes.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Update Products Votes
name: Update products votes

on:
schedule:
- cron: "30 1 * * *"
- cron: "30 1 * * *"
workflow_dispatch:

jobs:
update-products-votes:
Expand All @@ -12,15 +13,21 @@ jobs:
contents: write

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Python environment
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Update Products Votes
- name: Install dependencies
run: pip install requests

- name: Update products votes
run: python3 scripts/update-products-votes.py

- name: Git Commit & Push
- name: Git commit & push
run: |
git config user.name github-actions
git config user.email [email protected]
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ output.json
# Templates Caches
.versions.cache
.cache

# Build
dist/
34 changes: 34 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: 2

before:
hooks:
- go mod tidy

builds:
- id: verdex-cli
binary: verdex

env:
- CGO_ENABLED=0

goos: [windows,linux,darwin]
goarch: [amd64,386,arm,arm64]
ignore:
- goos: darwin
goarch: 386
- goos: windows
goarch: arm
- goos: windows
goarch: arm64

ldflags:
- -X github.com/verdexlab/verdex/verdex/core.releaseEnvironment=release-binary

archives:
- format: zip
id: verdex
builds: [verdex-cli]
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ if eq .Os "darwin" }}macOS{{ else }}{{ .Os }}{{ end }}_{{ .Arch }}'

checksum:
algorithm: sha256
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ minimum version of the service** (see [How It Works](/how-it-works) for more inf
🎯 Currently, Verdex supports detecting versions of **Keycloak** and **NextCloud** (see [Products](/essentials/products) documentation).

## 📖 Documentation
The entire tool documentation is available at:
[https://verdex-docs.mintlify.app](https://verdex-docs.mintlify.app)
The entire tool documentation is available at [https://verdex-docs.mintlify.app](https://verdex-docs.mintlify.app)

## 🚀 Install Verdex

Expand All @@ -29,15 +28,17 @@ echo 'alias verdex="docker run --rm verdexlab/verdex:latest"' >> ~/.bashrc
source ~/.bashrc
```

> 📖 Read documentation for more installation options: [https://verdex-docs.mintlify.app](https://verdex-docs.mintlify.app)
> 📖 Read documentation for more installation options:
[https://verdex-docs.mintlify.app/quickstart](https://verdex-docs.mintlify.app/quickstart)

## 🌪️ Run version detection

```bash
verdex -target https://keycloak.example.com -output-json ./results.json
```

> 📖 Read documentation for more detection options: [https://verdex-docs.mintlify.app](https://verdex-docs.mintlify.app)
> 📖 Read documentation for more detection options:
[https://verdex-docs.mintlify.app/essentials/options](https://verdex-docs.mintlify.app/essentials/options)

## License
Verdex is distributed under MIT License.
2 changes: 1 addition & 1 deletion docs/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ description: 'Learn how to run first Verdex detections in seconds.'

<Tab title="Binary">
Download the latest binary from official releases:
[https://github.com/verdexlab/verdex/releases?q=cli-&expanded=true](https://github.com/verdexlab/verdex/releases?q=cli-&expanded=true)
[https://github.com/verdexlab/verdex/releases?q=v&expanded=true](https://github.com/verdexlab/verdex/releases?q=v&expanded=true)
</Tab>
</Tabs>
</Step>
Expand Down
4 changes: 2 additions & 2 deletions verdex/core/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"github.com/verdexlab/verdex/verdex/thirdparty"
)

var cliReleasesPrefix = "cli-"
var cliReleasesUrl = "https://github.com/verdexlab/verdex/releases?q=cli-&expanded=true"
var cliReleasesPrefix = "v"
var cliReleasesUrl = "https://github.com/verdexlab/verdex/releases?q=v&expanded=true"
var cliReleaseCacheExpiration = 24 * time.Hour

// Check if a Verdex CLI update is available and render message
Expand Down

0 comments on commit 931e62f

Please sign in to comment.