Skip to content

Push to Github Container Registry #35

Push to Github Container Registry

Push to Github Container Registry #35

Workflow file for this run

name: Push to Github Container Registry
on:
workflow_dispatch:
inputs:
version:
type: string
required: true
description: The value of the release version tag, e.g. v0.12.0
env:
IMAGE_NAME: serverless-tools-gha
jobs:
push:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Build image
run: |
docker build . \
--file Dockerfile \
--tag "$IMAGE_NAME" \
--label org.opencontainers.image.source=https://github.com/${{ github.repository }}
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Push image
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
IMAGE_ID=ghcr.io/fac/"$IMAGE_NAME"
VERSION="v${{ github.event.inputs.version }}"
echo IMAGE_ID="$IMAGE_ID"
echo VERSION="$VERSION"
docker tag "$IMAGE_NAME" "$IMAGE_ID":"$VERSION"
docker push "$IMAGE_ID":"$VERSION"