mirror of
https://github.com/taigrr/yq
synced 2025-01-18 04:53:17 -08:00
Compare commits
6 Commits
v4.2.0
...
cswarth-do
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b887e23b3 | ||
|
|
a76b72e691 | ||
|
|
9509831cff | ||
|
|
e92180e89d | ||
|
|
a6ae33c3f1 | ||
|
|
94a563dfd8 |
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@@ -68,7 +68,9 @@ jobs:
|
|||||||
|
|
||||||
- name: Build and push image
|
- name: Build and push image
|
||||||
run: |
|
run: |
|
||||||
IMAGE_VERSION="$(git describe --tags --abbrev=0)"
|
IMAGE_V_VERSION="$(git describe --tags --abbrev=0)"
|
||||||
|
IMAGE_VERSION=${IMAGE_V_VERSION:1}
|
||||||
|
|
||||||
SHORT_SHA1=$(git rev-parse --short HEAD)
|
SHORT_SHA1=$(git rev-parse --short HEAD)
|
||||||
PLATFORMS="linux/amd64,linux/ppc64le,linux/arm64"
|
PLATFORMS="linux/amd64,linux/ppc64le,linux/arm64"
|
||||||
echo "Building and pushing version ${IMAGE_VERSION} of image ${IMAGE_NAME}"
|
echo "Building and pushing version ${IMAGE_VERSION} of image ${IMAGE_NAME}"
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ COPY scripts/devtools.sh /opt/devtools.sh
|
|||||||
|
|
||||||
RUN set -e -x \
|
RUN set -e -x \
|
||||||
&& /opt/devtools.sh
|
&& /opt/devtools.sh
|
||||||
|
ENV PATH=/go/bin:$PATH
|
||||||
|
|
||||||
# install mkdocs
|
# install mkdocs
|
||||||
RUN set -ex \
|
RUN set -ex \
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ Flags:
|
|||||||
-M, --no-colors force print with no colors
|
-M, --no-colors force print with no colors
|
||||||
-N, --no-doc Don't print document separators (---)
|
-N, --no-doc Don't print document separators (---)
|
||||||
-n, --null-input Don't read input, simply evaluate the expression given. Useful for creating yaml docs from scratch.
|
-n, --null-input Don't read input, simply evaluate the expression given. Useful for creating yaml docs from scratch.
|
||||||
|
-P, --prettyPrint pretty print, shorthand for '... style = ""'
|
||||||
-j, --tojson output as json. Set indent to 0 to print json in one line.
|
-j, --tojson output as json. Set indent to 0 to print json in one line.
|
||||||
-v, --verbose verbose mode
|
-v, --verbose verbose mode
|
||||||
-V, --version Print version information and quit
|
-V, --version Print version information and quit
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM mikefarah/yq:3
|
FROM mikefarah/yq:4.2.0
|
||||||
|
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ a: frog
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'select(. | documentIndex == 1)' sample.yml
|
yq eval 'select(documentIndex == 1)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -42,7 +42,7 @@ a: frog
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a | ({"match": ., "doc": (. | documentIndex)})' sample.yml
|
yq eval '.a | ({"match": ., "doc": documentIndex})' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ will output
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Pretty print
|
## Pretty print
|
||||||
Set empty (default) quote style, note the usage of `...` to match keys too.
|
Set empty (default) quote style, note the usage of `...` to match keys too. Note that there is a `--prettyPrint/-P` short flag for this.
|
||||||
|
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ var documentIndexScenarios = []expressionScenario{
|
|||||||
{
|
{
|
||||||
description: "Filter by document index",
|
description: "Filter by document index",
|
||||||
document: "a: cat\n---\na: frog\n",
|
document: "a: cat\n---\na: frog\n",
|
||||||
expression: `select(. | documentIndex == 1)`,
|
expression: `select(documentIndex == 1)`,
|
||||||
expected: []string{
|
expected: []string{
|
||||||
"D1, P[], (doc)::a: frog\n",
|
"D1, P[], (doc)::a: frog\n",
|
||||||
},
|
},
|
||||||
@@ -25,7 +25,7 @@ var documentIndexScenarios = []expressionScenario{
|
|||||||
{
|
{
|
||||||
description: "Print Document Index with matches",
|
description: "Print Document Index with matches",
|
||||||
document: "a: cat\n---\na: frog\n",
|
document: "a: cat\n---\na: frog\n",
|
||||||
expression: `.a | ({"match": ., "doc": (. | documentIndex)})`,
|
expression: `.a | ({"match": ., "doc": documentIndex})`,
|
||||||
expected: []string{
|
expected: []string{
|
||||||
"D0, P[], (!!map)::match: cat\ndoc: 0\n",
|
"D0, P[], (!!map)::match: cat\ndoc: 0\n",
|
||||||
"D0, P[], (!!map)::match: frog\ndoc: 1\n",
|
"D0, P[], (!!map)::match: frog\ndoc: 1\n",
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ e: >-
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "Pretty print",
|
description: "Pretty print",
|
||||||
subdescription: "Set empty (default) quote style, note the usage of `...` to match keys too.",
|
subdescription: "Set empty (default) quote style, note the usage of `...` to match keys too. Note that there is a `--prettyPrint/-P` short flag for this.",
|
||||||
document: `{a: cat, "b": 5, 'c': 3.2, "e": true}`,
|
document: `{a: cat, "b": 5, 'c': 3.2, "e": true}`,
|
||||||
expression: `... style=""`,
|
expression: `... style=""`,
|
||||||
expected: []string{
|
expected: []string{
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
- increment version in version.go
|
- increment version in version.go
|
||||||
- increment version in snapcraft.yaml
|
- increment version in snapcraft.yaml
|
||||||
|
- increment version in github-action/Dockerfile
|
||||||
- make sure local build passes
|
- make sure local build passes
|
||||||
- tag git with same version number
|
- tag git with same version number
|
||||||
- commit vX tag - this will trigger github actions
|
- commit vX tag - this will trigger github actions
|
||||||
- use github actions to publish docker and make github release
|
- use github actions to publish docker and make github release
|
||||||
|
- check github updated yq action in marketplace
|
||||||
|
|
||||||
- snapcraft
|
- snapcraft
|
||||||
- will auto create a candidate, test it works then promote
|
- will auto create a candidate, test it works then promote
|
||||||
|
|||||||
@@ -3,7 +3,12 @@
|
|||||||
set -o errexit
|
set -o errexit
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
./bin/golangci-lint run --timeout=5m
|
if command -v golangci-lint &> /dev/null
|
||||||
|
then
|
||||||
|
golangci-lint run --timeout=5m
|
||||||
|
else
|
||||||
|
./bin/golangci-lint run --timeout=5m
|
||||||
|
fi
|
||||||
|
|
||||||
# ./bin/golangci-lint \
|
# ./bin/golangci-lint \
|
||||||
# --tests \
|
# --tests \
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -ex
|
|
||||||
VERSION="$(git describe --tags --abbrev=0)"
|
|
||||||
docker build \
|
|
||||||
--target production \
|
|
||||||
--build-arg VERSION=${VERSION} \
|
|
||||||
-t mikefarah/yq:latest \
|
|
||||||
-t mikefarah/yq:${VERSION} \
|
|
||||||
-t mikefarah/yq:4 \
|
|
||||||
.
|
|
||||||
|
|
||||||
trivy image mikefarah/yq:${VERSION}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -ex
|
|
||||||
GITHUB_TOKEN="${GITHUB_TOKEN:?missing required input \'GITHUB_TOKEN\'}"
|
|
||||||
|
|
||||||
CURRENT="$(git describe --tags --abbrev=0)"
|
|
||||||
PREVIOUS="$(git describe --tags --abbrev=0 --always "${CURRENT}"^)"
|
|
||||||
OWNER="mikefarah"
|
|
||||||
REPO="yq"
|
|
||||||
|
|
||||||
release() {
|
|
||||||
github-release release \
|
|
||||||
--user "$OWNER" \
|
|
||||||
--draft \
|
|
||||||
--repo "$REPO" \
|
|
||||||
--tag "$CURRENT"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
release
|
|
||||||
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -ex
|
|
||||||
GITHUB_TOKEN="${GITHUB_TOKEN:?missing required input \'GITHUB_TOKEN\'}"
|
|
||||||
|
|
||||||
CURRENT="$(git describe --tags --abbrev=0)"
|
|
||||||
PREVIOUS="$(git describe --tags --abbrev=0 --always "${CURRENT}"^)"
|
|
||||||
OWNER="mikefarah"
|
|
||||||
REPO="yq"
|
|
||||||
|
|
||||||
upload() {
|
|
||||||
mkdir -p ./build-done
|
|
||||||
while IFS= read -r -d $'\0'; do
|
|
||||||
file=$REPLY
|
|
||||||
BINARY=$(basename "${file}")
|
|
||||||
echo "--> ${BINARY}"
|
|
||||||
github-release upload \
|
|
||||||
--replace \
|
|
||||||
--user "$OWNER" \
|
|
||||||
--repo "$REPO" \
|
|
||||||
--tag "$CURRENT" \
|
|
||||||
--name "${BINARY}" \
|
|
||||||
--file "$file"
|
|
||||||
mv "$file" "./build-done/${BINARY}"
|
|
||||||
done < <(find ./build -mindepth 1 -maxdepth 1 -print0)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
upload
|
|
||||||
Reference in New Issue
Block a user