Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
rimrakhimov committed Jan 21, 2024
1 parent 56e5d90 commit 6235853
Showing 1 changed file with 35 additions and 35 deletions.
70 changes: 35 additions & 35 deletions .github/workflows/services-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:

env:
REGISTRY: ghcr.io
IMAGE_NAME: blockscout/eth-bytecode-db
IMAGE_NAME: blockscout/services-base

jobs:
check_tag:
Expand Down Expand Up @@ -66,17 +66,15 @@ jobs:
- name: Check image tag exists
id: check_existence
env:
# TAG: ${{ steps.get_image_tag.outputs.tag }}
TAG: v0.2.0
TAG: ${{ steps.get_image_tag.outputs.tag }}
run: |
TOKEN=$(echo ${{ secrets.GITHUB_TOKEN }} | base64)
EXISTING_TAGS=$(curl -H "Authorization: Bearer ${TOKEN}" https://ghcr.io/v2/blockscout/visualizer/tags/list)
EXISTING_TAGS=$(curl -H "Authorization: Bearer ${TOKEN}" https://ghcr.io/v2/${IMAGE_NAME}/tags/list)
if echo "${EXISTING_TAGS}" | jq -e ".tags | map(select(. == \"$TAG\")) | length > 0" > /dev/null; then
echo "TAG $TAG exists in the tags array."
echo "There is already a pushed image with ${TAG} as tag. Skipping."
echo "is_new=false" >> $GITHUB_OUTPUT
else
echo "TAG $TAG does not exist in the tags array."
echo "is_new=true" >> $GITHUB_OUTPUT
fi
Expand All @@ -87,34 +85,36 @@ jobs:
if: needs.check_tag.outputs.is_new == 'true'
runs-on: ubuntu-latest
steps:
- name: Tag exists
run: |
echo "tag_exists=${{ needs.check_tag.outputs.is_new }}"
# - name: Checkout
# uses: actions/checkout@v4
#
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
#
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
#
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v2
# with:
# registry: ${{ env.REGISTRY }}
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

# - name: Extract metadata for Docker
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
#
# - name: Print docker tags
# run: |
# echo "tags=${{ steps.meta.outputs.tags }}"
# echo "labels=${{ steps.meta.outputs.labels }}"
#
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v5
with:
context: "docker"
file: "docker/base.Dockerfile"
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.check_tag.outputs.tag }} , ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
platforms: |
linux/amd64
linux/arm64/v8
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 6235853

Please sign in to comment.