Skip to content

Commit

Permalink
ci: use a separate workflow for choco (#19)
Browse files Browse the repository at this point in the history
* ci: use a separate workflow for choco

* docs: update windows install instructions
  • Loading branch information
ayuhito committed Feb 17, 2023
1 parent 85cbcf1 commit 611a073
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 61 deletions.
38 changes: 24 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@ jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Install Chocolatey
run: |
mkdir -p /opt/chocolatey
wget -q -O - "https://github.com/chocolatey/choco/releases/download/${CHOCOLATEY_VERSION}/chocolatey.v${CHOCOLATEY_VERSION}.tar.gz" | tar -xz -C "/opt/chocolatey"
echo '#!/bin/bash' >> /usr/local/bin/choco
echo 'mono /opt/chocolatey/choco.exe $@' >> /usr/local/bin/choco
chmod +x /usr/local/bin/choco
env:
CHOCOLATEY_VERSION: 1.2.1

- uses: actions/checkout@v3
with:
fetch-depth: 0
Expand All @@ -37,12 +27,10 @@ jobs:

- uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: ${{ env.GITHUB_REF_NAME }}
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GHTOKEN_GORELEASER }}
CHOCOLATEY_APIKEY: ${{ secrets.CHOCOLATEY_APIKEY }}

- run: echo "VERSION_NAME=${GITHUB_REF_NAME:1}" >> $GITHUB_ENV
- run: echo $VERSION_NAME
Expand Down Expand Up @@ -74,4 +62,26 @@ jobs:
RPM-PACKAGE-NAME: globalping_${{ env.VERSION_NAME }}_linux_amd64.rpm
PACKAGECLOUD-USERNAME: jsdelivr
PACKAGECLOUD-REPO: globalping
PACKAGECLOUD-TOKEN: ${{ secrets.PACKAGECLOUD_APIKEY }}
PACKAGECLOUD-TOKEN: ${{ secrets.PACKAGECLOUD_APIKEY }}

choco:
runs-on: windows-latest

steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-go@v3
with:
go-version: '>=1.20.0'
cache: true

- uses: goreleaser/goreleaser-action@v4
with:
version: ${{ env.GITHUB_REF_NAME }}
args: release --clean -f .goreleaser.choco.yaml
env:
GITHUB_TOKEN: ${{ secrets.GHTOKEN_GORELEASER }}
CHOCOLATEY_APIKEY: ${{ secrets.CHOCOLATEY_APIKEY }}
59 changes: 59 additions & 0 deletions .goreleaser.choco.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
before:
hooks:
- go mod tidy
- go generate ./...
builds:
-
id: "globalping"
binary: "globalping"
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin

release:
disable: true
skip_upload: true

chocolateys:
-
name: globalping

owners: jsdelivr

# The app's title.
# A human-friendly title of the package.
# Defaults to `ProjectName`.
title: Globalping CLI

# Your app's authors (probably you).
# Defaults are shown below.
authors: Ayuhito

# Your app's project url.
# It is a required field.
project_url: https://www.jsdelivr.com/globalping

# App's icon.
# Default is empty.
# icon_url: 'https://rawcdn.githack.com/foo/bar/efbdc760-395b-43f1-bf69-ba25c374d473/icon.png'

license_url: https://github.com/jsdelivr/globalping-cli/blob/master/LICENSE
project_source_url: https://github.com/jsdelivr/globalping-cli
docs_url: https://github.com/jsdelivr/globalping-cli/blob/master/README.md
bug_tracker_url: https://github.com/jsdelivr/globalping-cli/issues

summary: A global network of probes to run network tests like ping, traceroute and DNS resolve.

# This the description of your chocolatey package.
# Supports markdown.
description: |
{{ .ProjectName }} installer package.
A global network of probes to run network tests like ping, traceroute and DNS resolve.
release_notes: "https://github.com/jsdelivr/globalping-cli/releases/tag/v{{ .Version }}"
api_key: '{{ .Env.CHOCOLATEY_APIKEY }}'

# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
39 changes: 0 additions & 39 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,44 +70,5 @@ brews:
commit_author:
name: jimaek
email: dakulovgr@gmail.com

chocolateys:
-
name: globalping

owners: jsdelivr

# The app's title.
# A human-friendly title of the package.
# Defaults to `ProjectName`.
title: Globalping CLI

# Your app's authors (probably you).
# Defaults are shown below.
authors: Ayuhito

# Your app's project url.
# It is a required field.
project_url: https://www.jsdelivr.com/globalping

# App's icon.
# Default is empty.
# icon_url: 'https://rawcdn.githack.com/foo/bar/efbdc760-395b-43f1-bf69-ba25c374d473/icon.png'

license_url: https://github.com/jsdelivr/globalping-cli/blob/master/LICENSE
project_source_url: https://github.com/jsdelivr/globalping-cli
docs_url: https://github.com/jsdelivr/globalping-cli/blob/master/README.md
bug_tracker_url: https://github.com/jsdelivr/globalping-cli/issues

summary: A global network of probes to run network tests like ping, traceroute and DNS resolve.

# This the description of your chocolatey package.
# Supports markdown.
description: |
{{ .ProjectName }} installer package.
A global network of probes to run network tests like ping, traceroute and DNS resolve.
release_notes: "https://github.com/jsdelivr/globalping-cli/releases/tag/v{{ .Version }}"
api_key: '{{ .Env.CHOCOLATEY_APIKEY }}'

# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ Simply run these commands to install the repo and CLI! This way you will get all

### Ubuntu/Debian (deb)

```
```shell
curl -s https://packagecloud.io/install/repositories/jsdelivr/globalping/script.deb.sh | sudo bash
apt install globalping
```

### CentOS/Fedora/Rocky Linux/AlmaLinux (rpm)

```
```shell
curl -s https://packagecloud.io/install/repositories/jsdelivr/globalping/script.rpm.sh | sudo bash
dnf install globalping
```
Expand All @@ -36,18 +36,16 @@ dnf install globalping

### MacOS - Homebrew

```
```shell
brew tap jsdelivr/globalping
brew install globalping
```

### Windows - Chocolatey

[coming soon]

### Windows - Winget

[coming soon]
```shell
choco install globalping
```

### Binary installation

Expand Down

0 comments on commit 611a073

Please sign in to comment.