Skip to content

Commit 0db8ccf

Browse files
committed
replace Dockerfile build with GHCR image build
1 parent cfdce03 commit 0db8ccf

3 files changed

Lines changed: 48 additions & 2 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Publish Docker Image
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
workflow_dispatch:
8+
9+
jobs:
10+
push_to_registry:
11+
name: Push Docker image to GitHub Packages
12+
runs-on: ubuntu-latest
13+
permissions:
14+
packages: write
15+
contents: read
16+
steps:
17+
- name: Check out the repo
18+
uses: actions/checkout@v6
19+
20+
- name: Log in to GitHub Docker Registry
21+
uses: docker/login-action@v3
22+
with:
23+
registry: ghcr.io
24+
username: ${{ github.actor }}
25+
password: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Extract metadata (tags, labels) for Docker
28+
id: meta
29+
uses: docker/metadata-action@v5
30+
with:
31+
images: ghcr.io/${{ github.repository }}
32+
tags: |
33+
type=semver,pattern={{version}}
34+
type=semver,pattern={{major}}.{{minor}}
35+
type=semver,pattern={{major}}
36+
type=sha
37+
38+
- name: Build and push Docker image
39+
uses: docker/build-push-action@v6
40+
with:
41+
context: .
42+
push: true
43+
tags: ${{ steps.meta.outputs.tags }}
44+
labels: ${{ steps.meta.outputs.labels }}

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ This project uses [`ajv`](https://github.com/epoberezkin/ajv), fast JSON schema
1010

1111
## Usage
1212

13+
To use this GitHub Action, you can reference it in your workflow. For faster validation, this action uses a pre-built Docker image from the GitHub Container Registry (GHCR).
14+
1315
### Inputs
1416

1517
- `schema`: Relative file path in the repository to a JSON schema file to validate the other JSON files with. If no value is provided `./schema.json` will be used.
@@ -34,7 +36,7 @@ jobs:
3436
steps:
3537
- uses: actions/checkout@v1
3638
- name: Validate JSON with Glob
37-
uses: nhalstead/validate-json-action@0.1.8
39+
uses: nhalstead/validate-json-action@v0.1.9
3840
with:
3941
schema: /path/to/schema.json
4042
jsons: /path/to/file.json,/path/to/another/file.json

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ outputs:
1414
description: 'One or more of relative file paths of the invalid JSON files, found in the repository (separated by comma).'
1515
runs:
1616
using: 'docker'
17-
image: 'Dockerfile'
17+
image: 'docker://ghcr.io/nhalstead/validate-json-action:v0.1.9'
1818
branding:
1919
icon: 'check'
2020
color: purple

0 commit comments

Comments
 (0)