Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/release-js.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ jobs:
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- run: |
- name: Set version from tag and publish
run: |
cd js
VERSION=${GITHUB_REF_NAME#v}
npm --no-git-tag-version version "${VERSION}"
npm ci
npm run build-js
npm publish --provenance --access public
Expand Down
18 changes: 15 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ on:
workflow_dispatch:
release:
types: [created]

permissions:
contents: write
packages: write
Expand All @@ -17,7 +17,18 @@ jobs:
with:
go-version: '1.24.x'
- uses: ko-build/setup-ko@v0.8
- run: ko build --bare
- name: Build and push Docker image
run: |
VERSION=${GITHUB_REF_NAME:-dev}
TAGS="${VERSION}"
if [ "${{ github.event_name }}" = "release" ]; then
TAGS="${VERSION},latest"
fi
ko build --bare --tags "${TAGS}" \
--image-label "org.opencontainers.image.version=${VERSION}" \
--image-label "org.opencontainers.image.source=https://github.com/${{ github.repository }}"
env:
GOFLAGS: -ldflags=-X=github.com/reteps/dockerfmt/cmd.Version=${{ github.ref_name }}
releases-matrix:
name: Release Go Binary
runs-on: ubuntu-latest
Expand All @@ -35,4 +46,5 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goarch: ${{ matrix.goarch }}
ldflags: -X github.com/reteps/dockerfmt/cmd.Version=${{ github.ref_name }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ docker run --rm -v $(pwd):/pwd ghcr.io/reteps/dockerfmt:latest /pwd/tests/in/run
## Usage

```output
A updated version of the dockfmt. Uses the dockerfile parser from moby/buildkit and the shell formatter from mvdan/sh.
Format Dockerfiles and shell commands within RUN steps. If no files are specified, input is read from stdin.

Usage:
dockerfmt [Dockerfile...] [flags]
Expand Down
4 changes: 2 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ var (

var rootCmd = &cobra.Command{
Use: "dockerfmt [Dockerfile...]",
Short: "dockerfmt is a Dockerfile and RUN step formatter.",
Long: `A updated version of the dockfmt. Uses the dockerfile parser from moby/buildkit and the shell formatter from mvdan/sh.`,
Short: "Format Dockerfiles and shell commands within RUN steps",
Long: `Format Dockerfiles and shell commands within RUN steps. If no files are specified, input is read from stdin.`,
Run: Run,
Args: cobra.ArbitraryArgs,
}
Expand Down
7 changes: 6 additions & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import (
"github.com/spf13/cobra"
)

// Version is set at build time via ldflags:
//
// go build -ldflags "-X github.com/reteps/dockerfmt/cmd.Version=v0.4.0"
var Version = "dev"

func init() {
rootCmd.AddCommand(versionCmd)
}
Expand All @@ -14,6 +19,6 @@ var versionCmd = &cobra.Command{
Use: "version",
Short: "Print the version number of dockerfmt",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("dockerfmt 0.3.9")
fmt.Println("dockerfmt " + Version)
},
}
6 changes: 0 additions & 6 deletions dockerfmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ func TestFormatter(t *testing.T) {
fmt.Printf("Comparing file %s with %s\n", fileName, outFile)
formattedLines := lib.FormatFileLines(originalLines, c)

// Write outFile to directory
// err = os.WriteFile(outFile, []byte(formattedLines), 0644)
// if err != nil {
// t.Fatalf("Failed to write to file %s: %v", outFile, err)
// }

// Read outFile
outLines, err := lib.GetFileLines(outFile)
if err != nil {
Expand Down
Loading