mirror of
https://github.com/mikefarah/yq.git
synced 2026-07-10 08:35:42 +00:00
Compare commits
5 Commits
37bdd47b97
...
cb4077100a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb4077100a | ||
|
|
c9766c1cab | ||
|
|
337960a6d1 | ||
|
|
1395d6e230 | ||
|
|
9883ebc313 |
20
.github/workflows/docker-release.yml
vendored
20
.github/workflows/docker-release.yml
vendored
@ -30,6 +30,19 @@ jobs:
|
|||||||
- name: Available platforms
|
- name: Available platforms
|
||||||
run: echo ${{ steps.buildx.outputs.platforms }} && docker version
|
run: echo ${{ steps.buildx.outputs.platforms }} && docker version
|
||||||
|
|
||||||
|
- 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.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push image
|
- name: Build and push image
|
||||||
run: |
|
run: |
|
||||||
echo "GithubRef: ${GITHUB_REF}"
|
echo "GithubRef: ${GITHUB_REF}"
|
||||||
@ -41,7 +54,6 @@ jobs:
|
|||||||
PLATFORMS="linux/amd64,linux/ppc64le,linux/arm64,linux/arm/v7"
|
PLATFORMS="linux/amd64,linux/ppc64le,linux/arm64,linux/arm/v7"
|
||||||
|
|
||||||
echo "Building and pushing version ${IMAGE_VERSION} of image ${IMAGE_NAME}"
|
echo "Building and pushing version ${IMAGE_VERSION} of image ${IMAGE_NAME}"
|
||||||
echo '${{ secrets.DOCKER_PASSWORD }}' | docker login -u '${{ secrets.DOCKER_USERNAME }}' --password-stdin
|
|
||||||
docker buildx build \
|
docker buildx build \
|
||||||
--label "org.opencontainers.image.authors=https://github.com/mikefarah/yq/graphs/contributors" \
|
--label "org.opencontainers.image.authors=https://github.com/mikefarah/yq/graphs/contributors" \
|
||||||
--label "org.opencontainers.image.created=$(date --rfc-3339=seconds)" \
|
--label "org.opencontainers.image.created=$(date --rfc-3339=seconds)" \
|
||||||
@ -59,6 +71,9 @@ jobs:
|
|||||||
-t "${IMAGE_NAME}:${IMAGE_VERSION}" \
|
-t "${IMAGE_NAME}:${IMAGE_VERSION}" \
|
||||||
-t "${IMAGE_NAME}:4" \
|
-t "${IMAGE_NAME}:4" \
|
||||||
-t "${IMAGE_NAME}:latest" \
|
-t "${IMAGE_NAME}:latest" \
|
||||||
|
-t "ghcr.io/${IMAGE_NAME}:${IMAGE_VERSION}" \
|
||||||
|
-t "ghcr.io/${IMAGE_NAME}:4" \
|
||||||
|
-t "ghcr.io/${IMAGE_NAME}:latest" \
|
||||||
.
|
.
|
||||||
|
|
||||||
cd github-action
|
cd github-action
|
||||||
@ -79,4 +94,7 @@ jobs:
|
|||||||
-t "${IMAGE_NAME}:${IMAGE_VERSION}-githubaction" \
|
-t "${IMAGE_NAME}:${IMAGE_VERSION}-githubaction" \
|
||||||
-t "${IMAGE_NAME}:4-githubaction" \
|
-t "${IMAGE_NAME}:4-githubaction" \
|
||||||
-t "${IMAGE_NAME}:latest-githubaction" \
|
-t "${IMAGE_NAME}:latest-githubaction" \
|
||||||
|
-t "ghcr.io/${IMAGE_NAME}:${IMAGE_VERSION}-githubaction" \
|
||||||
|
-t "ghrc.io/${IMAGE_NAME}:4-githubaction" \
|
||||||
|
-t "ghcr.io/${IMAGE_NAME}:latest-githubaction" \
|
||||||
.
|
.
|
||||||
|
|||||||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@ -44,7 +44,7 @@ jobs:
|
|||||||
./scripts/xcompile.sh
|
./scripts/xcompile.sh
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
files: build/*
|
files: build/*
|
||||||
draft: true
|
draft: true
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package yqlib
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -95,12 +96,7 @@ func (f *Format) MatchesName(name string) bool {
|
|||||||
if f.FormalName == name {
|
if f.FormalName == name {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
for _, n := range f.Names {
|
return slices.Contains(f.Names, name)
|
||||||
if n == name {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Format) GetConfiguredEncoder() Encoder {
|
func (f *Format) GetConfiguredEncoder() Encoder {
|
||||||
|
|||||||
@ -39,13 +39,19 @@ func toNodes(candidate *CandidateNode, lhs *CandidateNode) []*CandidateNode {
|
|||||||
func addOperator(d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) {
|
func addOperator(d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) {
|
||||||
log.Debugf("Add operator")
|
log.Debugf("Add operator")
|
||||||
|
|
||||||
return crossFunction(d, context.ReadOnlyClone(), expressionNode, add, false)
|
return crossFunction(d, context.ReadOnlyClone(), expressionNode, add, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
func add(_ *dataTreeNavigator, context Context, lhs *CandidateNode, rhs *CandidateNode) (*CandidateNode, error) {
|
func add(_ *dataTreeNavigator, context Context, lhs *CandidateNode, rhs *CandidateNode) (*CandidateNode, error) {
|
||||||
lhsNode := lhs
|
lhsNode := lhs
|
||||||
|
|
||||||
if lhsNode.Tag == "!!null" {
|
if lhs == nil && rhs == nil {
|
||||||
|
return nil, nil
|
||||||
|
} else if lhs == nil {
|
||||||
|
return rhs.Copy(), nil
|
||||||
|
} else if rhs == nil {
|
||||||
|
return lhs.Copy(), nil
|
||||||
|
} else if lhsNode.Tag == "!!null" {
|
||||||
return lhs.CopyAsReplacement(rhs), nil
|
return lhs.CopyAsReplacement(rhs), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -310,6 +310,15 @@ var addOperatorScenarios = []expressionScenario{
|
|||||||
"D0, P[], (!!map)::a: !cat Saturday, 15-Dec-01 at 6:00AM GMT\n",
|
"D0, P[], (!!map)::a: !cat Saturday, 15-Dec-01 at 6:00AM GMT\n",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
skipDoc: true,
|
||||||
|
description: "Add to empty",
|
||||||
|
subdescription: "should behave like null",
|
||||||
|
expression: `.nada + "cat"`,
|
||||||
|
expected: []string{
|
||||||
|
"D0, P[], (!!str)::cat\n",
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
description: "Add to null",
|
description: "Add to null",
|
||||||
subdescription: "Adding to null simply returns the rhs",
|
subdescription: "Adding to null simply returns the rhs",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user