Skip to content

Commit c3ae617

Browse files
authored
Merge pull request #170 from morph-l2/docker-release-workflow
Create docker-release.yml
2 parents 1582a36 + 18acac7 commit c3ae617

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

.github/workflows/docker-release.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Docker Image CI
2+
3+
on:
4+
push:
5+
tags:
6+
- test-v*
7+
8+
env:
9+
IMAGE_NAME: go-ethereum
10+
11+
jobs:
12+
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Build the Docker image
21+
run: docker build . --file Dockerfile -t "${IMAGE_NAME}"
22+
23+
- name: Log into registry
24+
run: echo "${{ secrets.PACKAGE_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
25+
26+
- name: Push image
27+
run: |
28+
IMAGE_ID=ghcr.io/${{ github.repository }}
29+
30+
# Change all uppercase to lowercase
31+
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
32+
# Strip git ref prefix from version
33+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
34+
# Strip "morph-v" prefix from tag name
35+
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^test-v//')
36+
echo IMAGE_ID=$IMAGE_ID
37+
echo VERSION=$VERSION
38+
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
39+
docker tag $IMAGE_NAME $IMAGE_ID:latest
40+
docker push $IMAGE_ID:$VERSION
41+
docker push $IMAGE_ID:latest

0 commit comments

Comments
 (0)