Skip to content

Commit 3213673

Browse files
authored
Use Docker image instead of building on each action run (#34)
2 parents b391deb + 93db002 commit 3213673

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

.github/workflows/publish.yaml

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

action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ outputs:
5555
description: Version ID generated by Modrinth.
5656
runs:
5757
using: docker
58-
image: Dockerfile
58+
image: docker://ghcr.io/cloudnode-pro/modrinth-publish:2.0.0
5959
env:
6060
GH_INPUTS: ${{ toJSON(inputs) }}
6161
branding:

0 commit comments

Comments
 (0)