This commit is contained in:
i-norden 2022-02-01 12:08:25 -06:00
commit ec0fdb5215
5 changed files with 537 additions and 94 deletions

View File

@ -7,19 +7,23 @@ jobs:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get the version
id: vars
run: |
echo ::set-output name=sha::$(echo ${GITHUB_SHA:0:7})
echo ::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/})
- name: Docker Login to Github Registry
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login https://docker.pkg.github.com -u vulcanize --password-stdin
- name: Docker Pull
run: docker pull docker.pkg.github.com/vulcanize/eth-statediff-service/eth-statediff-service:${{steps.vars.outputs.sha}}
echo ::set-output name=sha::$(echo ${GITHUB_SHA})
id: vars
- name: Docker Login to Docker Registry
run: echo ${{ secrets.VULCANIZEJENKINS_PAT }} | docker login -u vulcanizejenkins --password-stdin
- name: Tag docker image
run: docker tag docker.pkg.github.com/vulcanize/eth-statediff-service/eth-statediff-service:${{steps.vars.outputs.sha}} vulcanize/eth-statediff-service:${{steps.vars.outputs.tag}}
- name: Docker Push to Docker Hub
run: docker push vulcanize/eth-statediff-service:${{steps.vars.outputs.tag}}
uses: docker/login-action@v1
with:
username: vulcanizejenkins
password: ${{ secrets.VULCANIZEJENKINS_PAT }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: vulcanize/eth-statediff-service:${{ steps.vars.outputs.tag }}
build-args: |
GIT_COMMIT=${{ steps.vars.outputs.sha }}

42
cmd/version.go Normal file
View File

@ -0,0 +1,42 @@
// VulcanizeDB
// Copyright © 2021 Vulcanize
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
v "github.com/vulcanize/eth-statediff-service/version"
)
// versionCmd represents the version command
var versionCmd = &cobra.Command{
Use: "version",
Short: "Prints the version of eth-statediff-service",
Long: `Use this command to fetch the version of eth-statediff-service
Usage: ./eth-statediff-service version`,
Run: func(cmd *cobra.Command, args []string) {
subCommand = cmd.CalledAs()
logWithCommand = *log.WithField("SubCommand", subCommand)
logWithCommand.Infof("eth-statediff-service version: %s", v.Version)
},
}
func init() {
rootCmd.AddCommand(versionCmd)
}

6
go.mod
View File

@ -5,10 +5,10 @@ go 1.16
require (
github.com/ethereum/go-ethereum v1.10.15
github.com/jmoiron/sqlx v1.2.0
github.com/prometheus/client_golang v1.0.0
github.com/prometheus/client_golang v1.4.0
github.com/sirupsen/logrus v1.7.0
github.com/spf13/cobra v1.1.1
github.com/spf13/viper v1.7.1
github.com/spf13/cobra v1.3.0
github.com/spf13/viper v1.10.0
github.com/vulcanize/go-eth-state-node-iterator v0.0.1-alpha.0.20211014064906-d23d01ed8191
)

527
go.sum

File diff suppressed because it is too large Load Diff

30
version/version.go Normal file
View File

@ -0,0 +1,30 @@
// VulcanizeDB
// Copyright © 2021 Vulcanize
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package version
import "fmt"
const (
major = 2 // major version component of the current release
minor = 0 // minor version component of the current release
patch = 0 // patch version component of the current release
)
// Version holds the textual version string.
var Version = func() string {
return fmt.Sprintf("%d.%d.%d", major, minor, patch)
}()