-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: migrate to golang * chore(main): release 1.7.0 (#59) * feat: migrate to golang * remove unused old files * chore(main): release 1.7.0 (#59) * chore: update test workflow * chore: update github action for go build
- Loading branch information
Showing
40 changed files
with
1,013 additions
and
2,016 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
name: release-please | ||
|
||
jobs: | ||
release-please: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: googleapis/release-please-action@v4 | ||
id: release | ||
with: | ||
# this assumes that you have created a personal access token | ||
# (PAT) and configured it as a GitHub action secret named | ||
# `MY_RELEASE_PLEASE_TOKEN` (this secret name is not important). | ||
token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }} | ||
# this is a built-in strategy in release-please, see "Action Inputs" | ||
# for more options | ||
release-type: node | ||
|
||
- uses: actions/checkout@v4 | ||
if: ${{ steps.release.outputs.release_created }} | ||
with: | ||
repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
ref: ${{ github.head_ref }} | ||
|
||
- name: Install Just | ||
if: ${{ steps.release.outputs.release_created }} | ||
uses: extractions/setup-just@v1 | ||
|
||
- uses: pnpm/action-setup@v4 | ||
if: ${{ steps.release.outputs.release_created }} | ||
- uses: actions/setup-node@v4 | ||
if: ${{ steps.release.outputs.release_created }} | ||
with: | ||
node-version: 22 | ||
cache: "pnpm" | ||
|
||
- uses: oven-sh/setup-bun@v2 | ||
if: ${{ steps.release.outputs.release_created }} | ||
with: | ||
bun-version: 1.1.34 | ||
|
||
- uses: actions/cache@v4 | ||
if: ${{ steps.release.outputs.release_created }} | ||
with: | ||
path: .turbo | ||
key: ${{ runner.os }}-turbo-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-turbo- | ||
|
||
- shell: bash | ||
if: ${{ steps.release.outputs.release_created }} | ||
run: pnpm install | ||
|
||
- name: Build project and prepare release artifact | ||
if: ${{ steps.release.outputs.release_created }} | ||
run: just compile | ||
|
||
- name: Upload Release Artifact | ||
if: ${{ steps.release.outputs.release_created }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }} | ||
run: | | ||
gh release upload ${{ steps.release.outputs.tag_name }} ./compile/cpenv-darwin-arm64 | ||
gh release upload ${{ steps.release.outputs.tag_name }} ./compile/cpenv-darwin-x64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
on: | ||
pull_request: | ||
branches: ["*"] | ||
tags-ignore: | ||
- "release-please--*" # Exclude tags containing "staging" | ||
|
||
name: test build | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
ref: ${{ github.head_ref }} | ||
|
||
- name: Install Just | ||
uses: extractions/setup-just@v1 | ||
|
||
- uses: pnpm/action-setup@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22 | ||
cache: "pnpm" | ||
|
||
- uses: oven-sh/setup-bun@v2 | ||
with: | ||
bun-version: 1.1.34 | ||
|
||
- uses: actions/cache@v4 | ||
with: | ||
path: .turbo | ||
key: ${{ runner.os }}-turbo-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-turbo- | ||
|
||
- shell: bash | ||
run: pnpm install | ||
|
||
- name: Build project and prepare release artifact | ||
run: just compile |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
Copyright © 2024 NAME HERE <EMAIL ADDRESS> | ||
*/ | ||
package cmd | ||
|
||
import ( | ||
"cpenv/core" | ||
"cpenv/utils" | ||
"fmt" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
// backupCmd represents the backup command | ||
var backupCmd = &cobra.Command{ | ||
Use: "backup", | ||
Short: "Backup current project env(s) to vault", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
config, err := core.LoadConfig() | ||
if err != nil { | ||
utils.Logger.Debug("Failed to load config", "message", err) | ||
fmt.Println(utils.ErrorMessage.Render("Please run `cpenv config init`")) | ||
return | ||
} | ||
|
||
utils.Logger.Debug("Running backupCmd", "Vault Directory", config.VaultDir) | ||
|
||
_, err = core.CreateEnvFilesDirectoryIfNotFound(config.VaultDir) | ||
if err != nil { | ||
utils.Logger.Error("Failed to create env file directory", "message", err) | ||
return | ||
} | ||
|
||
err = core.ConfirmCwd() | ||
if err != nil { | ||
utils.Logger.Error("Failed to confirm cwd", "message", err) | ||
return | ||
} | ||
|
||
err = core.CopyEnvFilesToVault() | ||
if err != nil { | ||
utils.Logger.Error("Failed to copy env files to vault", "message", err) | ||
return | ||
} | ||
fmt.Println(utils.SuccessMessage.Render(" Copy completed successfully")) | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(backupCmd) | ||
|
||
// Here you will define your flags and configuration settings. | ||
|
||
// Cobra supports Persistent Flags which will work for this command | ||
// and all subcommands, e.g.: | ||
// backupCmd.PersistentFlags().String("foo", "", "A help for foo") | ||
|
||
// Cobra supports local flags which will only run when this command | ||
// is called directly, e.g.: | ||
// backupCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
Copyright © 2024 NAME HERE <EMAIL ADDRESS> | ||
*/ | ||
package cmd | ||
|
||
import ( | ||
"cpenv/core" | ||
"cpenv/utils" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
// configCmd represents the init command | ||
var configCmd = &cobra.Command{ | ||
Use: "config", | ||
Short: "Config management for cpenv", | ||
} | ||
|
||
var configInitCmd = &cobra.Command{ | ||
Use: "init", | ||
Short: "Initialize a config for cpenv to work", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
_, err := core.LoadConfig() | ||
if err != nil { | ||
toInitConfig := &core.Config{VaultDir: ".env-files"} | ||
|
||
err := core.SaveConfig(toInitConfig) | ||
if err != nil { | ||
utils.Logger.Error("Failed to save config", "message", err) | ||
os.Exit(1) | ||
} | ||
|
||
fmt.Println(utils.SuccessMessage.Render(" Configuration initialized successfully!")) | ||
} else { | ||
fmt.Println(utils.ErrorMessage.Render("Configuration exists! Use `cpenv config edit` to edit it")) | ||
} | ||
}, | ||
} | ||
|
||
var configEditCmd = &cobra.Command{ | ||
Use: "edit", | ||
Short: "Edit the cpenv config with $EDITOR", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
_, err := core.LoadConfig() | ||
if err != nil { | ||
utils.Logger.Debug("Failed to load config", "message", err) | ||
fmt.Println(utils.ErrorMessage.Render("Please run `cpenv config init`")) | ||
return | ||
} | ||
|
||
if err := utils.OpenInEditor(core.ConfigPath); err != nil { | ||
utils.Logger.Error("Failed to open the file in editor", "message", err) | ||
} else { | ||
fmt.Println(utils.SuccessMessage.Render(" Successfully opened the file in editor.")) | ||
} | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(configCmd) | ||
|
||
configCmd.AddCommand(configInitCmd) | ||
configCmd.AddCommand(configEditCmd) | ||
|
||
// Here you will define your flags and configuration settings. | ||
|
||
// Cobra supports Persistent Flags which will work for this command | ||
// and all subcommands, e.g.: | ||
// initCmd.PersistentFlags().String("foo", "", "A help for foo") | ||
|
||
// Cobra supports local flags which will only run when this command | ||
// is called directly, e.g.: | ||
// initCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") | ||
} |
Oops, something went wrong.