Skip to content

Push Image

Push Image #14

Workflow file for this run

# Manually trigger image build and push.
# This must be done after publishing a new version of the package
# and updating `workspace/package.json` to use it.
name: Push Image
on:
workflow_dispatch:
inputs:
tag:
description: Tag for the new image
required: true
jobs:
build-and-push-image:
if: ${{ github.repository == 'codewars/lambda-calculus' }}
name: Build Images
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- name: Get image tag
run: |
# Remove `v` prefix if given
tag=${{ github.event.inputs.tag }}
echo "IMAGE_TAG=${tag#v}" >> $GITHUB_ENV
shell: bash
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/lambda-calculus:latest
ghcr.io/${{ github.repository_owner }}/lambda-calculus:${{ env.IMAGE_TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max