-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: Use a built Docker image (#28)
- Build and push a Docker image rather than requiring the user built it every time - Move some of the entrypoint to correct COPY and ENV statements - Chmod and copy at the same time as we're now using buildx - Use Ruby slim - Use specific version numbers for Ruby & mdl so renovate will bump the version numbers Signed-off-by: Dan Webb <[email protected]>
- Loading branch information
Showing
8 changed files
with
130 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,24 @@ | ||
--- | ||
name: Publish container | ||
name: Build & Publish container | ||
"on": | ||
release: | ||
types: [published] | ||
pull_request: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
push_to_registry: | ||
name: Publish to GitHub Container Registry | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
steps: | ||
- name: Code checkout | ||
uses: actions/checkout@v3 | ||
- name: Bump version and push tag | ||
id: tag_version | ||
uses: mathieudutour/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ghcr.io/${{ github.repository }} | ||
tags: | | ||
type=schedule | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}} | ||
type=sha | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
@@ -40,17 +30,27 @@ jobs: | |
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
if: ${{ github.event_name != 'pull_request' }} | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- uses: actions/checkout@main | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
push: true | ||
tags: | | ||
ghcr.io/${{ github.repository }}:${{ steps.tag_version.outputs.new_tag }} | ||
ghcr.io/${{ github.repository }}:latest | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
- name: Create a GitHub release | ||
uses: ncipollo/[email protected] | ||
with: | ||
tag: ${{ steps.tag_version.outputs.new_tag }} | ||
name: Release ${{ steps.tag_version.outputs.new_tag }} | ||
body: ${{ steps.tag_version.outputs.changelog }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
name: Build & Publish container | ||
"on": | ||
pull_request: | ||
|
||
jobs: | ||
build_and_publish: | ||
name: Build & Publish to GitHub Container Registry | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Code checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ghcr.io/${{ github.repository }} | ||
tags: | | ||
type=schedule | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Setup buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
install: true | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
FROM ruby | ||
RUN gem install mdl | ||
COPY . . | ||
RUN chmod +x /entrypoint.sh | ||
FROM ruby:3.2.0-slim | ||
ENV MATCHERS_DIR="._actionshub_problem-matchers" | ||
ENV MATCHER_FILE="${MATCHERS_DIR}/markdownlint.json" | ||
|
||
COPY markdownlint.json ${MATCHER_FILE} | ||
COPY Gemfile Gemfile.lock / | ||
RUN bundle install \ | ||
&& mkdir -p ${MATCHERS_DIR} \ | ||
&& echo "::[add-matcher]${MATCHER_FILE}" | ||
|
||
COPY --chmod=750 entrypoint.sh /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'mdl' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
chef-utils (18.1.0) | ||
concurrent-ruby | ||
concurrent-ruby (1.2.0) | ||
kramdown (2.4.0) | ||
rexml | ||
kramdown-parser-gfm (1.1.0) | ||
kramdown (~> 2.0) | ||
mdl (0.12.0) | ||
kramdown (~> 2.3) | ||
kramdown-parser-gfm (~> 1.1) | ||
mixlib-cli (~> 2.1, >= 2.1.1) | ||
mixlib-config (>= 2.2.1, < 4) | ||
mixlib-shellout | ||
mixlib-cli (2.1.8) | ||
mixlib-config (3.0.27) | ||
tomlrb | ||
mixlib-shellout (3.2.7) | ||
chef-utils | ||
rexml (3.2.5) | ||
tomlrb (2.0.3) | ||
|
||
PLATFORMS | ||
arm64-darwin-22 | ||
|
||
DEPENDENCIES | ||
mdl | ||
|
||
BUNDLED WITH | ||
2.4.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
name: 'MarkdownLint mdl Action' | ||
author: 'Jason Field' | ||
description: 'Run mdl on your markdown files with ease' | ||
name: "MarkdownLint mdl Action" | ||
author: "Jason Field" | ||
description: "Run mdl on your markdown files with ease" | ||
inputs: | ||
path: | ||
description: 'Path to scan for markdown files within the directory (and nested directories), note: cannot be used with filesToIgnore input' | ||
description: "Path to scan for markdown files within the directory (and nested directories), note: cannot be used with filesToIgnore input" | ||
required: false | ||
default: './' | ||
default: "./" | ||
filesToIgnoreRegex: | ||
description: 'A regex of files you do not want scanned, note: cannot be used with path input' | ||
description: "A regex of files you do not want scanned, note: cannot be used with path input" | ||
required: false | ||
outputs: | ||
output: # id of output | ||
description: 'stdout from mdl' | ||
description: "stdout from mdl" | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
using: "docker" | ||
image: "docker://ghcr.io/actionshub/markdownlint:v3.0.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters