Merge pull request #16 from levelsoftware/fix-release-for-v1.1.0

Fix for release for v1.1.0
This commit is contained in:
Ethan Knowlton 2023-11-14 03:52:56 -05:00 committed by GitHub
commit 060eb1dced
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 98 additions and 47 deletions

16
.github/release.yml vendored Normal file
View File

@ -0,0 +1,16 @@
changelog:
exclude:
labels:
- ignore-for-release
categories:
- title: Breaking Changes 🛠
labels:
- major
- breaking-change
- title: New Features 🎉
labels:
- minor
- feature
- title: Other

55
.github/workflows/release-please.yaml vendored Normal file
View File

@ -0,0 +1,55 @@
name: Release Please
on:
pull_request:
types:
- closed
permissions:
contents: write
pull-requests: write
jobs:
test:
if: |
github.event.pull_request.merged == true &&
github.ref_name == "master" &&
contains(github.event.pull_request.head.name, "release")
uses: ./.github/workflows/test.yaml
release-please:
if: |
github.event.pull_request.merged == true &&
github.ref_name == "master" &&
contains(github.event.pull_request.head.name, "release")
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.18.x"
- name: Build EchoIP binary
run: go build -o ./echoip ./cmd/echoip/main.go
- name: Upload Release Artifact
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
zip -r echoip-linux-amd64.zip echoip html LICENSE
- uses: google-github-actions/release-please-action@v3
with:
bootstrap-sha: "ef1f4b388c24e977ec63d6943ac8f0b0c5f51b58"
last-release-sha: "32a92399085082121675553e23d722605752519e"
release-type: "go"
release-as: "1.1.0"
command: "release-pr"
extra-files: |
echoip-linux-amd64-${{ github.ref_name }}.zip
echoip
html
LICENSE

View File

@ -1,32 +0,0 @@
name: Release
on:
push:
tags:
- "*"
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.18.x"
- name: Build EchoIP binary
run: go build -o ./echoip ./cmd/echoip/main.go
- name: Upload Release Artifact
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
zip -r echoip-linux-amd64-${{ github.ref_name }}.zip echoip html LICENSE
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: echoip-linux-amd64-${{ github.ref_name }}.zip
bodyFile: "CHANGELOG.md"

View File

@ -1,10 +1,13 @@
name: Test
on: [push]
on:
push:
branches:
- "*"
- "!master"
jobs:
test:
runs-on: ubuntu-latest
steps:

View File

@ -1,18 +1,14 @@
# Changelog
## 1.2.0 (2023-10-06)
## 1.1.0 (2023-11-14)
### Features
- RSA JWT Signature Validation
- ECDSA JWT Signature Validation
- JWT Authentication
## 1.1.0 (2023-10-06)
### Features
- Environment Variable Configuration [712e216](https://github.com/levelsoftware/echoip/commit/712e2166d51fdb85229f52caa380743245f31dfa)
## 1.0.0 (2023-10-06)
### Features

View File

@ -108,7 +108,7 @@ func main() {
serverCache = &cache.Null{}
}
if len(runConfig.Jwt.PublicKey) != 0 {
if runConfig.Jwt.Enabled && len(runConfig.Jwt.PublicKey) != 0 {
log.Printf("Loading public key from %s", runConfig.Jwt.PublicKey)
pubKey, err := os.ReadFile(runConfig.Jwt.PublicKey)

View File

@ -6,7 +6,7 @@ After=network.target
Type=simple
User=web
ExecStart=/usr/local/bin/echoip
ExecStart=/usr/local/bin/echoip -c /etc/echoip/config.toml
Restart=always
RestartSec=5s
StandardOutput=syslog

View File

@ -7,11 +7,11 @@ import (
"github.com/stretchr/testify/assert"
)
const ecdsaPublicKey = `-----BEGIN PUBLIC KEY-----
const EcdsaPublicKey = `-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEEVs/o5+uQbTjL3chynL4wXgUg2R9
q9UU8I5mEovUf86QZ7kOBIjJwqnzD1omageEHWwHdBO6B+dFabmdT9POxg==
-----END PUBLIC KEY-----`
const ecdsaToken = `eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.tyh-VfuzIxCyGYDlkBA7DfyjrqmSHu6pQ2hoZuFqUSLPNY2N0mpHb3nk5K17HWP_3cYHBw7AhHale5wky6-sVA`
const EcdsaToken = `eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.tyh-VfuzIxCyGYDlkBA7DfyjrqmSHu6pQ2hoZuFqUSLPNY2N0mpHb3nk5K17HWP_3cYHBw7AhHale5wky6-sVA`
const rsaPublicKey = `-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu1SU1LfVLPHCozMxH2Mo
@ -32,9 +32,9 @@ func TestGetTokenKeyWithECDSAKey(t *testing.T) {
Debug: true,
Jwt: config.Jwt{
SigningMethod: "ES256",
PublicKeyData: []byte(ecdsaPublicKey),
PublicKeyData: []byte(EcdsaPublicKey),
},
}, ecdsaToken)
}, EcdsaToken)
assert.Nil(t, err)
}

View File

@ -48,6 +48,7 @@ func (ips *IPStack) Parse(ip net.IP, hostname string) (parser.Response, error) {
ips.ParseTimezoneResponse(&parserResponse)
ips.ParseLocationResponse(&parserResponse)
ips.ParseConnectionResponse(&parserResponse)
ips.ParseCurrencyResponse(&parserResponse)
return parserResponse, nil
}
@ -116,6 +117,18 @@ func (ips *IPStack) ParseConnectionResponse(parserResponse *parser.Response) {
}
}
func (ips *IPStack) ParseCurrencyResponse(parserResponse *parser.Response) {
if ips.response.Currency != nil {
parserResponse.Currency = parser.Currency{
Code: parserResponse.Currency.Code,
Name: parserResponse.Currency.Name,
Plural: parserResponse.Currency.Plural,
Symbol: parserResponse.Currency.Symbol,
SymbolNative: parserResponse.Currency.SymbolNative,
}
}
}
func (ips *IPStack) IsEmpty() bool {
return false
}