diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6b9b5e2..90440bc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,12 +23,10 @@ jobs: env: GOOS: ${{ matrix.targetos }} GOARCH: ${{ matrix.arch }} - - - name: Set GOPRIVATE for private repositories - run: echo "export GOPRIVATE=github.com/ojo-network/indexer" >> $GITHUB_ENV - - name: Set GOPRIVATE for private repository - run: go env -w GOPRIVATE=github.com/ojo-network/example-repo - + GOPRIVATE: github.com/ojo-network/indexer + GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} + - name: Set up git config for the private repo + run: git config --global url.https://$GH_ACCESS_TOKEN@github.com/.insteadOf https://github.com/ - name: Compile run: | go mod download diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index a2c4fc8..7ceae49 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -55,3 +55,4 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + build-args: GH_ACCESS_TOKEN=${{secrets.GH_ACCESS_TOKEN}} diff --git a/Dockerfile b/Dockerfile index 39536b0..57f58c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,14 @@ # Build Image FROM golang:1.20-alpine AS builder +ARG GH_ACCESS_TOKEN + RUN apk add --no-cache build-base git WORKDIR /app COPY go.mod go.sum ./ -COPY .netrc /root/.netrc - +RUN git config --global url."https://${GH_ACCESS_TOKEN}:x-oauth-basic@github.com/".insteadOf "https://github.com/" ENV export GOPRIVATE=github.com/ojo-network/indexer RUN go mod download