Skip to content

Commit b55f408

Browse files
committed
create workflow to publish action image on GHCR
1 parent 5cb5c32 commit b55f408

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

.github/workflows/publish.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
env:
8+
IMAGE_NAME: release-upload-asset
9+
10+
jobs:
11+
publish:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Build image
18+
run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
19+
20+
- name: Log in to GitHub Container Registry
21+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
22+
23+
- name: Push image
24+
run: |
25+
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
26+
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
27+
TAG=${{ github.event.release.tag_name }}
28+
VERSION=${TAG#v}
29+
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
30+
docker push $IMAGE_ID:$VERSION

0 commit comments

Comments
 (0)