Merge pull request #543 from Infisical/multi-tag-repo

Only trigger CLI builds for tags with prefix infisical-cli/v*.*.*
This commit is contained in:
Maidul Islam
2023-04-30 11:30:36 -04:00
committed by GitHub
3 changed files with 28 additions and 12 deletions

View File

@@ -4,7 +4,7 @@ on:
push:
# run only against tags
tags:
- "v*"
- "infisical-cli/v*.*.*"
permissions:
contents: write
@@ -41,13 +41,14 @@ jobs:
git clone https://github.com/plentico/osxcross-target.git ../../osxcross/target
- uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
distribution: pro
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }}
FURY_TOKEN: ${{ secrets.FURYPUSHTOKEN }}
AUR_KEY: ${{ secrets.AUR_KEY }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
- uses: actions/setup-python@v4
- run: pip install --upgrade cloudsmith-cli
- name: Publish to CloudSmith

View File

@@ -11,6 +11,10 @@ before:
- ./cli/scripts/completions.sh
- ./cli/scripts/manpages.sh
monorepo:
tag_prefix: infisical-cli/
dir: cli
builds:
- id: darwin-build
binary: infisical
@@ -74,14 +78,7 @@ checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ incpatch .Version }}-devel"
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
name_template: "{{ .Version }}-devel"
# publishers:
# - name: fury.io

View File

@@ -4,12 +4,14 @@ import (
"encoding/json"
"errors"
"fmt"
log "github.com/sirupsen/logrus"
"io"
"net/http"
"os"
"os/exec"
"runtime"
"strings"
log "github.com/sirupsen/logrus"
"github.com/fatih/color"
)
@@ -73,7 +75,23 @@ func getLatestTag(repoOwner string, repoName string) (string, error) {
return "", fmt.Errorf("failed to unmarshal github response: %w", err)
}
return tags[0].Name[1:], nil
// Filter tags with prefix "infisical-cli/"
prefix := "infisical-cli/v"
var validTags []string
for _, tag := range tags {
if strings.HasPrefix(tag.Name, prefix) {
validTags = append(validTags, tag.Name)
}
}
if len(validTags) == 0 {
return "", errors.New("no tags for the CLI is found")
}
// Extract the version from the first valid tag
version := strings.TrimPrefix(validTags[0], prefix)
return version, nil
}
func GetUpdateInstructions() string {