diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml new file mode 100644 index 00000000..f49c6c6a --- /dev/null +++ b/.github/workflows/actions.yml @@ -0,0 +1,31 @@ +on: + workflow_dispatch: + +jobs: + converge: + name: Converge + runs-on: ubuntu-latest + steps: + + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install werf + uses: werf/actions/install@v1.2 + + - name: Log in to registry + # This is where you will update the personal access token to GITHUB_TOKEN + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin + + - name: Run echo + run: | + werf version + docker version + echo $GITHUB_REPOSITORY + echo $GITHUB_SHA + - name: Run Build + run: | + . $(werf ci-env github --as-file) + werf export service --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_SHA \ No newline at end of file diff --git a/.github/workflows/actions_onlymain.yml b/.github/workflows/actions_onlymain.yml new file mode 100644 index 00000000..60182be3 --- /dev/null +++ b/.github/workflows/actions_onlymain.yml @@ -0,0 +1,36 @@ +on: + push: + branches: + - 'main' + - 'master' + - 'chains/mainnet' + - 'chains/mainnet-beta' + +jobs: + converge: + name: Converge + runs-on: ubuntu-latest + steps: + + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install werf + uses: werf/actions/install@v1.2 + + - name: Log in to registry + # This is where you will update the personal access token to GITHUB_TOKEN + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin + + - name: Run echo + run: | + werf version + docker version + echo $GITHUB_REPOSITORY + echo $GITHUB_SHA + - name: Run Build + run: | + . $(werf ci-env github --as-file) + werf export service --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_SHA \ No newline at end of file diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml new file mode 100644 index 00000000..676c1ca1 --- /dev/null +++ b/.github/workflows/tag.yml @@ -0,0 +1,33 @@ +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + +jobs: + converge: + name: Converge + runs-on: ubuntu-latest + steps: + + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install werf + uses: werf/actions/install@v1.2 + + - name: Log in to registry + # This is where you will update the personal access token to GITHUB_TOKEN + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin + + - name: Run echo + run: | + werf version + docker version + echo $GITHUB_REPOSITORY + echo $GITHUB_REF_NAME + - name: Run Build + run: | + . $(werf ci-env github --as-file) + werf export service --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_REF_NAME \ No newline at end of file diff --git a/werf-giterminism.yaml b/werf-giterminism.yaml deleted file mode 100644 index 44687a56..00000000 --- a/werf-giterminism.yaml +++ /dev/null @@ -1,5 +0,0 @@ - -giterminismConfigVersion: 1 -config: - goTemplateRendering: - allowEnvVariables: ["CI_JOB_TOKEN"] diff --git a/werf.yaml b/werf.yaml index e2c5b365..69608f0b 100644 --- a/werf.yaml +++ b/werf.yaml @@ -1,36 +1,34 @@ configVersion: 1 -project: "backend" +project: "core" --- -image: builder # Название собираемого образа. -from: golang:1.20-alpine # Базовый образ. +image: builder +from: golang:1.20-alpine docker: WORKDIR: /go/src/github.com/rarimo/rarimo-core -git: # Секция с директивами для добавления исходных файлов из git-репозитория. - - add: / # Исходный путь в репозитории. - to: /go/src/github.com/rarimo/rarimo-core # Путь назначения в образе. - stageDependencies: # Настройка перевыполнения сборочных инструкций при изменениях определённых файлов в репозитории. +git: + - add: / + to: /go/src/github.com/rarimo/rarimo-core + stageDependencies: install: - go.mod - go.sum - setup: # Для стадии Setup. + setup: - "**/*" -shell: # Shell сборочные инструкции. +shell: install: - apk add git build-base - - git config --global url."https://gitlab-ci-token:{{ env "CI_JOB_TOKEN" }}@gitlab.com/".insteadOf https://gitlab.com/ - - echo "machine gitlab.com login gitlab-ci-token password {{ env "CI_JOB_TOKEN" }}" > ~/.netrc - - go env -w GOPRIVATE=gitlab.com/* - - go env -w GONOSUMDB=gitlab.com/* - - go env -w GONOPROXY=gitlab.com/* + - go env -w GOPRIVATE=github.com/* + - go env -w GONOSUMDB=github.com/* + - go env -w GONOPROXY=github.com/* - cd /go/src/github.com/rarimo/rarimo-core - go mod tidy - go mod vendor - go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@latest - cp $GOPATH/bin/cosmovisor /usr/local/bin/cosmovisor - setup: # Для стадии Setup. - - export GOPRIVATE=gitlab.com/* - - export GONOSUMDB=gitlab.com/* - - export GONOPROXY=gitlab.com/* + setup: + - export GOPRIVATE=github.com/* + - export GONOSUMDB=github.com/* + - export GONOPROXY=github.com/* - export CGO_ENABLED=1 - export GO111MODULE=on - export GOOS=linux @@ -38,12 +36,12 @@ shell: # Shell сборочные инструкции. - go build -o /usr/local/bin/rarimo-core /go/src/github.com/rarimo/rarimo-core/cmd/rarimo-cored --- -image: service # Название собираемого образа. -from: alpine:3.9 # Базовый образ. +image: service +from: alpine:3.9 docker: ENTRYPOINT: rarimo-core -shell: # Shell сборочные инструкции. - setup: # Для стадии Setup. +shell: + setup: - apk add --no-cache ca-certificates import: - image: builder