Skip to content

Commit

Permalink
Add workflow to manually update image
Browse files Browse the repository at this point in the history
  • Loading branch information
kazk committed Feb 16, 2022
1 parent 44923fb commit ee5388a
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/update-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Manually trigger image build and push.
name: Update Image
on:
workflow_dispatch:
inputs:
tag:
description: Tag for the new image
required: true
jobs:
build-and-push-image:
if: ${{ github.repository == 'codewars/ocaml' }}
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 }}:latest
ghcr.io/${{ github.repository }}:${{ env.IMAGE_TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max

0 comments on commit ee5388a

Please sign in to comment.