From b6d88a0ae81d36a56ad2bfbe5a1712b26375bfa5 Mon Sep 17 00:00:00 2001 From: Alex Savin Date: Tue, 11 Feb 2025 17:05:21 -0500 Subject: [PATCH] Some changes --- .github/workflows/build.yml | 5 ++++- .github/workflows/deploy.yml | 36 +++++++++++++++++++++++++++++++++++ .github/workflows/testing.yml | 4 ++++ Dockerfile | 7 +++++-- config/config.go | 5 +++-- workers/claude.go | 2 +- workers/gemini.go | 2 +- workers/openai.go | 2 +- 8 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4e4d160..465431a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,9 @@ jobs: # echo "##[set-output name=version;]VERSION=${GITHUB_REF#$"refs/tags/v"}" # echo "##[set-output name=version_tag;]$GITHUB_REPOSITORY:${GITHUB_REF#$"refs/tags/v"}" # echo "##[set-output name=latest_tag;]$GITHUB_REPOSITORY:latest" - + echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT + echo REPO_VERSION=${GITHUB_REF_NAME#v} >> $GITHUB_OUTPUT + echo "RELEASE_DATE=$(date --rfc-3339=date)" >> ${GITHUB_ENV} # - name: Print Version # run: | # echo ${{steps.version_step.outputs.version_tag}} @@ -63,6 +65,7 @@ jobs: push: true tags: | docker.savin.nyc/${{ github.event.repository.name }}:latest +# ${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }} # latest diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..0f9a36b --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,36 @@ +name: Deploy Project + +on: + push: + branches: [develop] + paths-ignore: + - 'README.md' +# - '.github/**' + pull_request: + branches: [develop] + paths-ignore: + - 'README.md' +# - '.github/**' + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + + - uses: actions/checkout@v3 + + - name: Setup SSH + shell: bash + run: | + eval `ssh-agent -s` + mkdir -p /home/runner/.ssh/ + touch /home/runner/.ssh/id_rsa + echo -e "${{secrets.SSH_KEY}}" > /home/runner/.ssh/id_rsa + chmod 700 /home/runner/.ssh/id_rsa + ssh-keyscan -t rsa,dsa,ecdsa,ed25519 ${{secrets.SSH_HOST}} >> /home/runner/.ssh/known_hosts + + - name: SSH to the Prod env + shell: bash + run: | + ssh gitea@${{secrets.SSH_HOST}} + whoiam diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 30e72c8..b2e4192 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -9,11 +9,15 @@ jobs: go-version: [1.23.x] os: [ubuntu-latest] runs-on: ${{ matrix.os }} + steps: + - uses: actions/setup-go@v3 with: go-version: ${{ matrix.go-version }} + - uses: actions/checkout@v3 + - run: | go get -u . go test ./. diff --git a/Dockerfile b/Dockerfile index 62c59e0..45dde1c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,7 +24,7 @@ ARG VENDOR LABEL org.label-schema.build-date=$BUILD_DATE \ # org.label-schema.name=$NAME \ # org.label-schema.description="Example of multi-stage docker build" \ - org.label-schema.url="https://savin.nyc" \ + org.label-schema.url="https://alex.savin.nyc" \ org.label-schema.vcs-url=https://github.com/alex-savin/$VCS_URL \ # org.label-schema.vcs-ref=$VCS_REF \ # org.label-schema.vendor=$VENDOR \ @@ -32,4 +32,7 @@ LABEL org.label-schema.build-date=$BUILD_DATE \ org.label-schema.docker.schema-version="1.0" # org.label-schema.docker.cmd="docker run -d alextanhongpin/hello-world" -CMD ["./go-receipt-tracker"] \ No newline at end of file +VOLUME /app/blobs +VOLUME /app/config + +CMD ["./go-receipt-tracker"] diff --git a/config/config.go b/config/config.go index 7345e0c..56b9e6e 100644 --- a/config/config.go +++ b/config/config.go @@ -8,7 +8,7 @@ import ( ) var ( - Message_welcome = `Welcome to Receipts Tracker Bot – Your Ultimate Receipt Tracking Solution! + Message_welcome = `Welcome to Receipts Tracker Bot - Your Ultimate Receipt Tracking Solution! We are thrilled to have you join our community. At Receipts Tracker, we are committed to making your financial management effortless and efficient. Our advanced receipt tracking system is designed to help you organize, store, and manage all your receipts in one secure place. @@ -17,7 +17,7 @@ Why Choose Receipts Tracker? Easy Organization: Seamlessly categorize and store your receipts for quick access. Secure Storage: Enjoy peace of mind with our top-notch security measures. Effortless Management: Track your expenses and stay on top of your finances with ease. -User-Friendly Interface: Navigate our intuitive platform with ease, even if you’re not tech-savvy. +User-Friendly Interface: Navigate our intuitive platform with ease, even if you are not tech-savvy. Getting Started Sign Up: Create your free account in just a few clicks. @@ -141,6 +141,7 @@ func New() (*Config, error) { viper.SetConfigName("config") // name of config file (without extension) viper.SetConfigType("yml") // REQUIRED if the config file does not have the extension in the name viper.AddConfigPath("./") // optionally look for config in the working directory + viper.AddConfigPath("/app/config") // optionally look for config in the working directory viper.AddConfigPath("/etc/tracker") // optionally look for config in the working directory viper.AutomaticEnv() diff --git a/workers/claude.go b/workers/claude.go index a865c7a..b5c742b 100644 --- a/workers/claude.go +++ b/workers/claude.go @@ -28,7 +28,7 @@ func NewClaude(cfg *config.Parser, b *bus.Bus) *Claude { ai := &Claude{ id: cfg.Type, // "claude", - model: cfg.Model, // "gpt-4o-mini" + model: cfg.Model, // "claude-3-5-sonnet-latest"" opts: cfg, subscriptions: make(map[string]chan bus.Event), bus: b, diff --git a/workers/gemini.go b/workers/gemini.go index 6bab176..74be995 100644 --- a/workers/gemini.go +++ b/workers/gemini.go @@ -29,7 +29,7 @@ type Gemini struct { func NewGemini(cfg *config.Parser, b *bus.Bus) *Gemini { ai := &Gemini{ id: cfg.Type, // "gemini", - model: cfg.Model, // "gemini-1.5-flash" + model: cfg.Model, // [ "gemini-1.5-flash", "gemini-2.0-flash-preview-02-05" ] opts: cfg, subscriptions: make(map[string]chan bus.Event), bus: b, diff --git a/workers/openai.go b/workers/openai.go index 794d74d..cefda89 100644 --- a/workers/openai.go +++ b/workers/openai.go @@ -27,7 +27,7 @@ func NewOpenAi(cfg *config.Parser, b *bus.Bus) *OpenAi { ai := &OpenAi{ id: cfg.Type, // "openai", - model: cfg.Model, // "gpt-4o-mini" + model: cfg.Model, // [ "o1-mini", "gpt-4o-mini" ] opts: cfg, subscriptions: make(map[string]chan bus.Event), bus: b,