Skip to content

Commit

Permalink
use an access token for builds & docker
Browse files Browse the repository at this point in the history
  • Loading branch information
adamewozniak committed Jan 18, 2024
1 parent 2dfad25 commit 281d1b6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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://[email protected]/.insteadOf https://github.com/
- name: Compile
run: |
go mod download
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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}:[email protected]/".insteadOf "https://github.com/"
ENV export GOPRIVATE=github.com/ojo-network/indexer

RUN go mod download
Expand Down

0 comments on commit 281d1b6

Please sign in to comment.