Skip to content

Commit

Permalink
Merge pull request #83 from invopop/upload_component
Browse files Browse the repository at this point in the history
Fix linter and add release GH action
  • Loading branch information
beliolfa authored Nov 20, 2024
2 parents 8939151 + 9c5d41c commit ad97a4b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 44 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Auto-Version

on:
push:
branches:
- main

jobs:
tag:
name: Release
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: '0'

- name: Get Repo Details
run: |
echo "COMMIT_TYPE=$(echo $GITHUB_REF | cut -d / -f 2)" >> $GITHUB_ENV
echo "REPO_NAME=$(echo $GITHUB_REPOSITORY | cut -d / -f 2-)" >> $GITHUB_ENV
echo "REPO_VERSION=$(echo $GITHUB_REF | cut -d / -f 3-)" >> $GITHUB_ENV
- name: Bump version and push tag
id: bump
if: env.COMMIT_TYPE != 'tags'
uses: anothrNick/github-tag-action@1.52.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_BRANCHES: main
WITH_V: true
13 changes: 0 additions & 13 deletions go/cmd/popui/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ import (
"syscall"
)

// build data provided by goreleaser and mage setup
var (
version = "dev"
date = ""
)

func main() {
if err := run(); err != nil {
_, _ = fmt.Fprintln(os.Stderr, err)
Expand All @@ -28,10 +22,3 @@ func run() error {

return root().cmd().ExecuteContext(ctx)
}

func inputFilename(args []string) string {
if len(args) > 0 && args[0] != "-" {
return args[0]
}
return ""
}
31 changes: 0 additions & 31 deletions go/cmd/popui/root.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package main

import (
"io"
"os"

"github.com/spf13/cobra"
)

Expand All @@ -25,31 +22,3 @@ func (o *rootOpts) cmd() *cobra.Command {

return cmd
}

func (o *rootOpts) outputFilename(args []string) string {
if len(args) >= 2 && args[1] != "-" {
return args[1]
}
return ""
}

func openInput(cmd *cobra.Command, args []string) (io.ReadCloser, error) {
if inFile := inputFilename(args); inFile != "" {
return os.Open(inFile)
}
return io.NopCloser(cmd.InOrStdin()), nil
}

func (o *rootOpts) openOutput(cmd *cobra.Command, args []string) (io.WriteCloser, error) {
if outFile := o.outputFilename(args); outFile != "" {
flags := os.O_CREATE | os.O_WRONLY
return os.OpenFile(outFile, flags, os.ModePerm)
}
return writeCloser{cmd.OutOrStdout()}, nil
}

type writeCloser struct {
io.Writer
}

func (writeCloser) Close() error { return nil }

0 comments on commit ad97a4b

Please sign in to comment.