Skip to content

Commit ee5388a

Browse files
committed
Add workflow to manually update image
1 parent 44923fb commit ee5388a

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

.github/workflows/update-image.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Manually trigger image build and push.
2+
name: Update Image
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: Tag for the new image
8+
required: true
9+
jobs:
10+
build-and-push-image:
11+
if: ${{ github.repository == 'codewars/ocaml' }}
12+
name: Build Images
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Get image tag
21+
run: |
22+
# Remove `v` prefix if given
23+
tag=${{ github.event.inputs.tag }}
24+
echo "IMAGE_TAG=${tag#v}" >> $GITHUB_ENV
25+
shell: bash
26+
27+
- name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@v1
29+
30+
- name: Login to GitHub Container Registry
31+
uses: docker/login-action@v1
32+
with:
33+
registry: ghcr.io
34+
username: ${{ github.repository_owner }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- name: Build and push image
38+
uses: docker/build-push-action@v2
39+
with:
40+
context: .
41+
push: true
42+
tags: |
43+
ghcr.io/${{ github.repository }}:latest
44+
ghcr.io/${{ github.repository }}:${{ env.IMAGE_TAG }}
45+
cache-from: type=gha
46+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)