chore: bump docker/login-action from 3.0.0 to 3.1.0 (#171) #479
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This Github Action will build and publish images to github registry automatically. | |
# The image version can be either `latest` from the main branch or a tag whenever a tag is created. | |
name: Building and Publishing to GitHub | |
on: | |
push: | |
branches: | |
- main | |
create: | |
# Publish semver tags as releases. | |
tags: [ 'v*.*.*' ] | |
permissions: | |
contents: read | |
packages: write | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_VERSION: latest | |
GO_VERSION: '1.22.2' | |
jobs: | |
export-registry: | |
runs-on: ubuntu-20.04 | |
outputs: | |
registry: ${{ steps.export.outputs.registry }} | |
steps: | |
- id: export | |
run: | | |
# registry must be in lowercase | |
echo "::set-output name=registry::$(echo "${{ env.REGISTRY }}/${{ github.repository }}" | tr [:upper:] [:lower:])" | |
publish-images: | |
needs: export-registry | |
env: | |
REGISTRY: ${{ needs.export-registry.outputs.registry }} | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Set up Go ${{ env.GO_VERSION }} | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- uses: actions/checkout@v4 | |
- name: Set image version for a new release | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
echo "IMAGE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Login to ${{ env.REGISTRY }} | |
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push controller manager images to registry | |
run: | | |
make push | |
env: | |
REGISTRY: ${{ env.REGISTRY}} | |
TAG: ${{ env.IMAGE_VERSION }} |