Skip to content

Commit

Permalink
improve indentation of action workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
itchyny committed Nov 26, 2023
1 parent 326fde3 commit ff520e5
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 90 deletions.
78 changes: 39 additions & 39 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CI
on:
push:
branches:
- main
- main
pull_request:

permissions:
Expand All @@ -18,41 +18,41 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
go: [1.21.x, 1.20.x, 1.19.x]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- name: Test
run: make test
- name: Test with GOARCH=386
run: env GOARCH=386 go test -v ./...
if: matrix.os != 'macos-latest'
- name: Lint
run: make lint
- name: Check tools
run: make check-tools
- name: Check go generate
run: go generate && ! git diff | grep ^
shell: bash
- name: Check command examples in README.md
run: |
./gojq -Rnr 'reduce inputs as $x (
{};
if $x|test("^ [$] .*gojq|^```")
then
if .command
then .results += [{command: .command, output: .output}] | del(.command,.output)
end | if $x|test("gojq") then .command = $x[3:] end
elif .command then .output += ($x + "\n" | sub(" +#.*"; ""))
end
) | .results[] |
"if got=$(diff <(printf %s \(.output | @sh)) \\
<(\(.command | gsub("gojq"; "./gojq")) 2>&1)); then
echo ok: \(.command | @sh)
else
echo ng: \(.command | @sh); echo \"$got\"; exit 1
fi"
' README.md | bash
shell: bash
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- name: Test
run: make test
- name: Test with GOARCH=386
run: env GOARCH=386 go test -v ./...
if: matrix.os != 'macos-latest'
- name: Lint
run: make lint
- name: Check tools
run: make check-tools
- name: Check go generate
run: go generate && ! git diff | grep ^
shell: bash
- name: Check command examples in README.md
run: |
./gojq -Rnr 'reduce inputs as $x (
{};
if $x|test("^ [$] .*gojq|^```")
then
if .command
then .results += [{command: .command, output: .output}] | del(.command,.output)
end | if $x|test("gojq") then .command = $x[3:] end
elif .command then .output += ($x + "\n" | sub(" +#.*"; ""))
end
) | .results[] |
"if got=$(diff <(printf %s \(.output | @sh)) \\
<(\(.command | gsub("gojq"; "./gojq")) 2>&1)); then
echo ok: \(.command | @sh)
else
echo ng: \(.command | @sh); echo \"$got\"; exit 1
fi"
' README.md | bash
shell: bash
102 changes: 51 additions & 51 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Release
on:
push:
tags:
- 'v*'
- v*

permissions:
contents: write
Expand All @@ -14,59 +14,59 @@ jobs:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.x
- name: Cross build
run: make cross
- name: Create Release
uses: ncipollo/release-action@v1
with:
name: Release ${{ github.ref_name }}
artifacts: 'goxz/*'
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.x
- name: Cross build
run: make cross
- name: Create Release
uses: ncipollo/release-action@v1
with:
name: Release ${{ github.ref_name }}
artifacts: goxz/*

docker:
name: Docker
runs-on: ubuntu-latest
needs: release
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Docker metadata
uses: docker/metadata-action@v5
id: metadata
with:
images: |
${{ github.repository }}
ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and release Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
provenance: false
platforms: linux/amd64, linux/arm64
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
- name: Checkout code
uses: actions/checkout@v4
- name: Docker metadata
uses: docker/metadata-action@v5
id: metadata
with:
images: |
${{ github.repository }}
ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and release Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
provenance: false
platforms: linux/amd64, linux/arm64
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}

0 comments on commit ff520e5

Please sign in to comment.