From fef00cd18780bbc94ac7d0ae960b39442980b086 Mon Sep 17 00:00:00 2001 From: Alex Lovell-Troy Date: Mon, 29 Jan 2024 15:19:04 -0500 Subject: [PATCH] Fix 0.0.19 build errors and add a github action to test release on PRs to main --- .github/workflows/{go.yml => releaser.yml} | 0 .github/workflows/test-releaser.yml | 40 ++++++++++++++++++++++ CHANGELOG.md | 6 ++++ main.go | 5 ++- 4 files changed, 48 insertions(+), 3 deletions(-) rename .github/workflows/{go.yml => releaser.yml} (100%) create mode 100644 .github/workflows/test-releaser.yml diff --git a/.github/workflows/go.yml b/.github/workflows/releaser.yml similarity index 100% rename from .github/workflows/go.yml rename to .github/workflows/releaser.yml diff --git a/.github/workflows/test-releaser.yml b/.github/workflows/test-releaser.yml new file mode 100644 index 0000000..3bf52c8 --- /dev/null +++ b/.github/workflows/test-releaser.yml @@ -0,0 +1,40 @@ +# This workflow will build a golang project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go + +name: Test with goreleaser + +on: + pull_request: + branches: + - main +jobs: + + build: + runs-on: ubuntu-latest + + steps: + - name: Set up Go 1.21 + uses: actions/setup-go@v5 + with: + go-version: 1.21 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Docker Login + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-tags: 1 + fetch-depth: 1 + - name: Release with goreleaser + uses: goreleaser/goreleaser-action@v5 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + version: latest + args: --clean --snapshot + id: goreleaser-snapshot diff --git a/CHANGELOG.md b/CHANGELOG.md index 16e88ca..e3c39da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.0.19] - 2024-01-29 + +### Removed + +- Attempting to write the config file to the filesystem isn't a good idea when running in a container. We removed that. + ## [0.0.18] - 2024-01-18 ### Added diff --git a/main.go b/main.go index cad7d1d..7f7ae80 100644 --- a/main.go +++ b/main.go @@ -1,9 +1,7 @@ package main import ( - "crypto/rand" "database/sql" - "encoding/hex" "fmt" "os" "time" @@ -51,7 +49,8 @@ func execSQL(db *sql.DB, query string) error { func main() { - if config_file == "" { + config_file := os.Getenv("OCHAMI_CONFIG") + if config_file == "" { log.Fatal("OCHAMI_CONFIG is required") } config, err := readConfig(config_file)