Skip to content

Remove incorrect Readme #3

Remove incorrect Readme

Remove incorrect Readme #3

name: Build & Publish container images to GHCR
on:
push:
branches:
- main
tags:
- 'v*.*.*'
pull_request:
branches:
- main
jobs:
build-and-publish:
permissions:
packages: write
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to GitHub Container Registry
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.22'
- name: Install dependencies
run: make $(LOCALBIN)
- name: Build and push Docker image using Make
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
run: |
if [[ ${{ github.ref }} == refs/tags/v*.*.* ]]; then
TAG=${{ github.ref_name }}
MAJOR=$(echo $TAG | cut -d. -f1)
MAJOR_MINOR=$(echo $TAG | cut -d. -f1-2)
make docker-buildx IMG=ghcr.io/${{ github.repository }}/grpc-basic-auth:$TAG
make docker-buildx IMG=ghcr.io/${{ github.repository }}/grpc-basic-auth:latest
make docker-buildx IMG=ghcr.io/${{ github.repository }}/grpc-basic-auth:$MAJOR
make docker-buildx IMG=ghcr.io/${{ github.repository }}/grpc-basic-auth:$MAJOR_MINOR
else
BRANCH=$(echo ${{ github.ref_name }} | sed 's/\//-/g')
make docker-buildx IMG=ghcr.io/${{ github.repository }}/grpc-basic-auth:$BRANCH
fi
- name: Log out from GitHub Container Registry
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
run: docker logout ghcr.io