From b32a6174a2d61ee58a9dfb0eea68b3bcc47ee82c Mon Sep 17 00:00:00 2001 From: Matthieu Vachon Date: Wed, 10 Jul 2024 14:25:42 -0400 Subject: [PATCH] Enabling Docker package building (trying at least) --- .github/workflows/docker_publish.yml | 76 +++++++++++++++++----------- 1 file changed, 46 insertions(+), 30 deletions(-) diff --git a/.github/workflows/docker_publish.yml b/.github/workflows/docker_publish.yml index ef497f67e8..e10616723b 100644 --- a/.github/workflows/docker_publish.yml +++ b/.github/workflows/docker_publish.yml @@ -2,9 +2,15 @@ name: Create and Push Docker Image on: push: + branches: + - release/firehose tags: - 'v[0-9]+.[0-9]+.[0-9]+' # ignore rc +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + jobs: sei-images: runs-on: ubuntu-latest @@ -12,44 +18,54 @@ jobs: packages: write contents: read steps: - - - name: Check out the repo - uses: actions/checkout@v3 - - - name: Set up QEMU + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: 1.21 + + - name: Display the version of go that we have installed + run: go version + + - name: Compile the binary + run: | + make install + + mkdir /root/build + cp "`go env GOPATH`/bin/seid" /root/build/seid + + - name: Set up QEMU uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx + + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + - name: Login to GitHub Container Registry uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - - name: Parse tag - id: tag - run: | - VERSION=$(echo ${{ github.ref_name }} | sed "s/v//") - MAJOR_VERSION=$(echo $VERSION | cut -d '.' -f 1) - MINOR_VERSION=$(echo $VERSION | cut -d '.' -f 2) - PATCH_VERSION=$(echo $VERSION | cut -d '.' -f 3) - echo "VERSION=$VERSION" >> $GITHUB_ENV - echo "MAJOR_VERSION=$MAJOR_VERSION" >> $GITHUB_ENV - echo "MINOR_VERSION=$MINOR_VERSION" >> $GITHUB_ENV - echo "PATCH_VERSION=$PATCH_VERSION" >> $GITHUB_ENV - - - name: Build and push - id: build_push_image + + - name: Generate docker tags/labels from github build context + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=tag + type=sha,prefix=,enable=true + type=raw,enable=${{ github.ref == 'refs/heads/release/firehose' }},value=develop + flavor: | + latest=${{ startsWith(github.ref, 'refs/tags/') }} + + - name: Build and push Docker image uses: docker/build-push-action@v4 with: - file: Dockerfile - context: . + file: Dockerfile.sf + context: /root/build push: true - platforms: linux/amd64,linux/arm64 - tags: | - ghcr.io/sei-protocol/sei:${{ env.MAJOR_VERSION }} - ghcr.io/sei-protocol/sei:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }} - ghcr.io/sei-protocol/sei:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}.${{ env.PATCH_VERSION }} - ghcr.io/sei-protocol/sei:v${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}.${{ env.PATCH_VERSION }} \ No newline at end of file + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}