Skip to content

Commit 11463e6

Browse files
authored
Publish image on GHCR (#2)
2 parents fb12453 + b55f408 commit 11463e6

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
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

action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ inputs:
99
required: true
1010
runs:
1111
using: docker
12-
image: Dockerfile
12+
image: docker://ghcr.io/cloudnode-pro/release-upload-asset:1.0.0
1313
env:
1414
GH_INPUTS: ${{ toJSON(inputs) }}
1515

0 commit comments

Comments
 (0)