File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed
Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -17,16 +17,25 @@ jobs:
1717 outputs :
1818 IMAGE_TAG : ${{ steps.ct_image_tag.outputs.IMAGE_TAG }}
1919 IMAGE_PATH_0 : ghcr.io/${{ github.repository }}
20+ ROSETTA_BRANCH : ${{ steps.ct_image_tag.outputs.ROSETTA_BRANCH }}
2021 steps :
2122 - uses : actions/checkout@v3
2223 with :
2324 fetch-depth : 0
2425 - id : ct_image_tag
2526 run : |
26- TAG_NORMALIZED=$(echo ${GITHUB_REF#refs/*/} | sed "s/[^[:alpha:]0-9.-]/-/g")
27+ # For pull requests, use GITHUB_HEAD_REF (source branch of PR)
28+ # For push events, extract branch name from GITHUB_REF
29+ if [ -n "$GITHUB_HEAD_REF" ]; then
30+ BRANCH_NAME=$GITHUB_HEAD_REF
31+ else
32+ BRANCH_NAME=${GITHUB_REF#refs/*/}
33+ fi
34+ TAG_NORMALIZED=$(echo "$BRANCH_NAME" | sed "s/[^[:alpha:]0-9.-]/-/g")
2735 if [[ "$TAG_NORMALIZED" == "main" ]]; then echo "IMAGE_TAG=latest" >> $GITHUB_OUTPUT
2836 else echo "IMAGE_TAG=$TAG_NORMALIZED" >> $GITHUB_OUTPUT
2937 fi
38+ echo "ROSETTA_BRANCH=$BRANCH_NAME" >> $GITHUB_OUTPUT
3039
3140 build-container :
3241 runs-on : ubuntu-latest
4958 - name : Build and push container image
5059 shell : bash
5160 run : |
52- docker build --progress=plain --no-cache --build-arg ROSETTA_SRC=. --tag ${{ needs.define-env.outputs.IMAGE_PATH_0 }}:${{ needs.define-env.outputs.IMAGE_TAG }} -f ./server/Dockerfile .
61+ docker build --progress=plain --no-cache --build-arg ROSETTA_SRC=. --build-arg ROSETTA_BRANCH=${{ needs.define-env.outputs.ROSETTA_BRANCH }} -- tag ${{ needs.define-env.outputs.IMAGE_PATH_0 }}:${{ needs.define-env.outputs.IMAGE_TAG }} -f ./server/Dockerfile .
5362 docker push ${{ needs.define-env.outputs.IMAGE_PATH_0 }}:${{ needs.define-env.outputs.IMAGE_TAG }}
5463 - name : get image sha256
5564 id : image_sha256
Original file line number Diff line number Diff line change @@ -20,8 +20,9 @@ RUN cd avalanchego && \
2020# ------------------------------------------------------------------------------
2121FROM golang:1.22 AS rosetta
2222
23- ARG ROSETTA_SRC=https://github.com/flare-foundation/flare-rosetta/archive/refs/heads/main.zip
24- ARG ROSETTA_SRC_ZIP_SUBFOLDER=flare-rosetta-main
23+ ARG ROSETTA_BRANCH=main
24+ ARG ROSETTA_SRC=https://github.com/flare-foundation/flare-rosetta/archive/refs/heads/${ROSETTA_BRANCH}.zip
25+ ARG ROSETTA_SRC_ZIP_SUBFOLDER=flare-rosetta-${ROSETTA_BRANCH}
2526
2627WORKDIR /tmp
2728
4445 GO_VERSION=$(go version | awk {'print $3' }) \
4546 GIT_COMMIT=main \
4647 go mod download && \
47- go mod vendor && \
4848 make setup && \
4949 make build
5050
You can’t perform that action at this time.
0 commit comments