refactor: Move to $GITHUB_OUTPUT for step outputs.
This commit is contained in:
parent
0712f5046d
commit
aedbb92f63
135
.github/workflows/containers.yml
vendored
135
.github/workflows/containers.yml
vendored
@ -32,22 +32,19 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Timestamp
|
- name: Timestamp
|
||||||
id: timestamp
|
id: timestamp
|
||||||
run: echo ::set-output name=timestamp::$(date +%Y%m%d%H%M%S)
|
run: echo "timestamp=$(date +%Y%m%d%H%M%S)" >> $GITHUB_OUTPUT
|
||||||
architectures:
|
architectures:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
json: ${{ steps.import.outputs.json }}
|
json: ${{ steps.import.outputs.json }}
|
||||||
steps:
|
steps:
|
||||||
|
- name: Install yaml2json
|
||||||
|
run: python3 -m pip install remarshal
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Import from architectures.yml
|
- name: Import from architectures.yml
|
||||||
id: import
|
id: import
|
||||||
shell: python
|
run: echo "json=$(yaml2json architectures.yml | jq -c .)" >> $GITHUB_OUTPUT
|
||||||
run: |
|
|
||||||
import yaml, json
|
|
||||||
with open('architectures.yml', 'r') as file:
|
|
||||||
architectures = yaml.safe_load(file)
|
|
||||||
print('::set-output name=json::' + json.dumps(architectures))
|
|
||||||
tags:
|
tags:
|
||||||
needs:
|
needs:
|
||||||
- timestamp
|
- timestamp
|
||||||
@ -81,12 +78,12 @@ jobs:
|
|||||||
MAJOR_MINOR=${MAJOR}.${MINOR}
|
MAJOR_MINOR=${MAJOR}.${MINOR}
|
||||||
MAJOR_MINOR_BRANCH=${MAJOR_MINOR}-branch
|
MAJOR_MINOR_BRANCH=${MAJOR_MINOR}-branch
|
||||||
|
|
||||||
echo ::set-output name=branch::${BRANCH}
|
echo "branch=${BRANCH}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=base::${BASE}
|
echo "base=${BASE}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=candidate::${CANDIDATE}
|
echo "candidate=${CANDIDATE}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=versions::${VERSIONS}
|
echo "versions=${VERSIONS}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=major-minor::${MAJOR_MINOR}
|
echo "major-minor=${MAJOR_MINOR}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=major-minor-branch::${MAJOR_MINOR_BRANCH}
|
echo "major-minor-branch=${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
|
||||||
dev-generic:
|
dev-generic:
|
||||||
needs:
|
needs:
|
||||||
- timestamp
|
- timestamp
|
||||||
@ -119,15 +116,15 @@ jobs:
|
|||||||
BASE: ${{ needs.tags.outputs.base }}
|
BASE: ${{ needs.tags.outputs.base }}
|
||||||
MAJOR_MINOR_BRANCH: ${{ needs.tags.outputs.major-minor-branch }}
|
MAJOR_MINOR_BRANCH: ${{ needs.tags.outputs.major-minor-branch }}
|
||||||
run: |
|
run: |
|
||||||
echo ::set-output name=local::/tmp/.buildx/dev-generic
|
echo "local=/tmp/.buildx/dev-generic" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=local-new::/tmp/.buildx/dev-generic-new
|
echo "local-new=/tmp/.buildx/dev-generic-new" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=branch::docker.io/${NS}/${REPOSITORY}:${BRANCH}
|
echo "branch=docker.io/${NS}/${REPOSITORY}:${BRANCH}" >> $GITHUB_OUTPUT
|
||||||
if [ ! -z "$BASE" ]; then
|
if [ ! -z "$BASE" ]; then
|
||||||
echo ::set-output name=base::docker.io/${NS}/${REPOSITORY}:${BASE}
|
echo "base=docker.io/${NS}/${REPOSITORY}:${BASE}" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
echo ::set-output name=major-minor-branch::docker.io/${NS}/${REPOSITORY}:${MAJOR_MINOR_BRANCH}
|
echo "major-minor-branch=docker.io/${NS}/${REPOSITORY}:${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=branch-upstream::docker.io/${NSU}/${REPOSITORY}:${BRANCH}
|
echo "branch-upstream=docker.io/${NSU}/${REPOSITORY}:${BRANCH}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=major-minor-branch-upstream::docker.io/${NSU}/${REPOSITORY}:${MAJOR_MINOR_BRANCH}
|
echo "major-minor-branch-upstream=docker.io/${NSU}/${REPOSITORY}:${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
|
||||||
- name: Set up cache
|
- name: Set up cache
|
||||||
id: cache
|
id: cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
@ -219,8 +216,8 @@ jobs:
|
|||||||
id: repositories
|
id: repositories
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo ::set-output name=build::zmk-build-${{ matrix.architecture }}
|
echo "build=zmk-build-${{ matrix.architecture }}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=dev::zmk-dev-${{ matrix.architecture }}
|
echo "dev=zmk-dev-${{ matrix.architecture }}" >> $GITHUB_OUTPUT
|
||||||
- name: Define paths
|
- name: Define paths
|
||||||
id: paths
|
id: paths
|
||||||
shell: bash
|
shell: bash
|
||||||
@ -234,23 +231,23 @@ jobs:
|
|||||||
BASE: ${{ needs.tags.outputs.base }}
|
BASE: ${{ needs.tags.outputs.base }}
|
||||||
MAJOR_MINOR_BRANCH: ${{ needs.tags.outputs.major-minor-branch }}
|
MAJOR_MINOR_BRANCH: ${{ needs.tags.outputs.major-minor-branch }}
|
||||||
run: |
|
run: |
|
||||||
echo ::set-output name=dev-generic::/tmp/.buildx/dev-generic
|
echo "dev-generic=/tmp/.buildx/dev-generic" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=build-candidate::docker.io/${NS}/${BUILD}:${CANDIDATE}
|
echo "build-candidate=docker.io/${NS}/${BUILD}:${CANDIDATE}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=build-branch::docker.io/${NS}/${BUILD}:${BRANCH}
|
echo "build-branch=docker.io/${NS}/${BUILD}:${BRANCH}" >> $GITHUB_OUTPUT
|
||||||
if [ ! -z "$BASE" ]; then
|
if [ ! -z "$BASE" ]; then
|
||||||
echo ::set-output name=build-base::docker.io/${NS}/${BUILD}:${BASE}
|
echo "build-base=docker.io/${NS}/${BUILD}:${BASE}" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
echo ::set-output name=build-major-minor-branch::docker.io/${NS}/${BUILD}:${MAJOR_MINOR_BRANCH}
|
echo "build-major-minor-branch=docker.io/${NS}/${BUILD}:${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=build-branch-upstream::docker.io/${NSU}/${BUILD}:${BRANCH}
|
echo "build-branch-upstream=docker.io/${NSU}/${BUILD}:${BRANCH}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=build-major-minor-branch-upstream::docker.io/${NSU}/${BUILD}:${MAJOR_MINOR_BRANCH}
|
echo "build-major-minor-branch-upstream=docker.io/${NSU}/${BUILD}:${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=dev-candidate::docker.io/${NS}/${DEV}:${CANDIDATE}
|
echo "dev-candidate=docker.io/${NS}/${DEV}:${CANDIDATE}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=dev-branch::docker.io/${NS}/${DEV}:${BRANCH}
|
echo "dev-branch=docker.io/${NS}/${DEV}:${BRANCH}" >> $GITHUB_OUTPUT
|
||||||
if [ ! -z "$BASE" ]; then
|
if [ ! -z "$BASE" ]; then
|
||||||
echo ::set-output name=dev-base::docker.io/${NS}/${DEV}:${BASE}
|
echo "dev-base=docker.io/${NS}/${DEV}:${BASE}" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
echo ::set-output name=dev-major-minor-branch::docker.io/${NS}/${DEV}:${MAJOR_MINOR_BRANCH}
|
echo "dev-major-minor-branch=docker.io/${NS}/${DEV}:${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=dev-branch-upstream::docker.io/${NSU}/${DEV}:${BRANCH}
|
echo "dev-branch-upstream=docker.io/${NSU}/${DEV}:${BRANCH}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=dev-major-minor-branch-upstream::docker.io/${NSU}/${DEV}:${MAJOR_MINOR_BRANCH}
|
echo "dev-major-minor-branch-upstream=docker.io/${NSU}/${DEV}:${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
|
||||||
- name: Define build-args
|
- name: Define build-args
|
||||||
id: build-args
|
id: build-args
|
||||||
shell: bash
|
shell: bash
|
||||||
@ -260,12 +257,11 @@ jobs:
|
|||||||
ARCHITECTURE=${{ matrix.architecture }}
|
ARCHITECTURE=${{ matrix.architecture }}
|
||||||
ZEPHYR_SDK_VERSION=${{ env.zephyr-sdk-version }}
|
ZEPHYR_SDK_VERSION=${{ env.zephyr-sdk-version }}
|
||||||
"
|
"
|
||||||
# Escapes %, \n and \r
|
|
||||||
# See: https://github.community/t/set-output-truncates-multiline-strings/16852
|
delimiter="$(openssl rand -hex 8)"
|
||||||
LIST="${LIST//'%'/'%25'}"
|
echo "list<<${delimiter}" >> $GITHUB_OUTPUT
|
||||||
LIST="${LIST//$'\n'/'%0A'}"
|
echo "${LIST}" >> $GITHUB_OUTPUT
|
||||||
LIST="${LIST//$'\r'/'%0D'}"
|
echo "${delimiter}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=list::${LIST}
|
|
||||||
- name: Define labels
|
- name: Define labels
|
||||||
id: labels
|
id: labels
|
||||||
shell: bash
|
shell: bash
|
||||||
@ -274,12 +270,11 @@ jobs:
|
|||||||
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
|
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
|
||||||
org.opencontainers.image.revision=${{ github.sha }}
|
org.opencontainers.image.revision=${{ github.sha }}
|
||||||
"
|
"
|
||||||
# Escapes %, \n and \r
|
delimiter="$(openssl rand -hex 8)"
|
||||||
# See: https://github.community/t/set-output-truncates-multiline-strings/16852
|
|
||||||
LIST="${LIST//'%'/'%25'}"
|
echo "list<<${delimiter}" >> $GITHUB_OUTPUT
|
||||||
LIST="${LIST//$'\n'/'%0A'}"
|
echo "${LIST}" >> $GITHUB_OUTPUT
|
||||||
LIST="${LIST//$'\r'/'%0D'}"
|
echo "${delimiter}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=list::${LIST}
|
|
||||||
- name: Set up dev-generic cache
|
- name: Set up dev-generic cache
|
||||||
id: dev-generic-cache
|
id: dev-generic-cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
@ -514,28 +509,28 @@ jobs:
|
|||||||
TAG=${GITHUB_REF#refs/tags/}
|
TAG=${GITHUB_REF#refs/tags/}
|
||||||
PATTERN="^(.+?)-((([0-9]{4})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01]))(([01]?[0-9]|2[0-3])([0-5][0-9])([0-5][0-9])))-(([0-9]+)\.([0-9]+)\.([0-9]+))-(([0-9]+)\.([0-9]+)\.([0-9]+))-([0-9a-fA-F]+)-([0-9]+)$"
|
PATTERN="^(.+?)-((([0-9]{4})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01]))(([01]?[0-9]|2[0-3])([0-5][0-9])([0-5][0-9])))-(([0-9]+)\.([0-9]+)\.([0-9]+))-(([0-9]+)\.([0-9]+)\.([0-9]+))-([0-9a-fA-F]+)-([0-9]+)$"
|
||||||
if [[ "${TAG}" =~ $PATTERN ]]; then
|
if [[ "${TAG}" =~ $PATTERN ]]; then
|
||||||
echo ::set-output name=tag::${TAG}
|
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=branch::${BASH_REMATCH[1]}
|
echo "branch=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=datetime::${BASH_REMATCH[2]}
|
echo "datetime=${BASH_REMATCH[2]}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=date::${BASH_REMATCH[3]}
|
echo "date=${BASH_REMATCH[3]}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=year::${BASH_REMATCH[4]}
|
echo "year=${BASH_REMATCH[4]}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=month::${BASH_REMATCH[5]}
|
echo "month=${BASH_REMATCH[5]}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=day::${BASH_REMATCH[6]}
|
echo "day=${BASH_REMATCH[6]}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=time::${BASH_REMATCH[7]}
|
echo "time=${BASH_REMATCH[7]}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=hour::${BASH_REMATCH[8]}
|
echo "hour=${BASH_REMATCH[8]}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=minute::${BASH_REMATCH[9]}
|
echo "minute=${BASH_REMATCH[9]}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=second::${BASH_REMATCH[10]}
|
echo "second=${BASH_REMATCH[10]}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=zephyr-version::${BASH_REMATCH[11]}
|
echo "zephyr-version=${BASH_REMATCH[11]}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=zephyr-version-major::${BASH_REMATCH[12]}
|
echo "zephyr-version-major=${BASH_REMATCH[12]}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=zephyr-version-minor::${BASH_REMATCH[13]}
|
echo "zephyr-version-minor=${BASH_REMATCH[13]}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=zephyr-version-patch::${BASH_REMATCH[14]}
|
echo "zephyr-version-patch=${BASH_REMATCH[14]}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=zephyr-sdk-version::${BASH_REMATCH[15]}
|
echo "zephyr-sdk-version=${BASH_REMATCH[15]}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=zephyr-sdk-version-major::${BASH_REMATCH[16]}
|
echo "zephyr-sdk-version-major=${BASH_REMATCH[16]}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=zephyr-sdk-version-minor::${BASH_REMATCH[17]}
|
echo "zephyr-sdk-version-minor=${BASH_REMATCH[17]}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=zephyr-sdk-version-patch::${BASH_REMATCH[18]}
|
echo "zephyr-sdk-version-patch=${BASH_REMATCH[18]}" >> $GITHUB_OUTPUT
|
||||||
SHA=${BASH_REMATCH[19]}
|
SHA=${BASH_REMATCH[19]}
|
||||||
echo ::set-output name=sha::${SHA}
|
echo "sha=${SHA}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=run-id::${BASH_REMATCH[20]}
|
echo "run-id=${BASH_REMATCH[20]}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
if [[ "${{ github.sha }}" != ${SHA}* ]]; then
|
if [[ "${{ github.sha }}" != ${SHA}* ]]; then
|
||||||
echo "Hashes do not match!"
|
echo "Hashes do not match!"
|
||||||
@ -619,8 +614,8 @@ jobs:
|
|||||||
TAG=${GITHUB_REF#refs/tags/}
|
TAG=${GITHUB_REF#refs/tags/}
|
||||||
PATTERN="^(.+?)-stable$"
|
PATTERN="^(.+?)-stable$"
|
||||||
if [[ "${TAG}" =~ $PATTERN ]]; then
|
if [[ "${TAG}" =~ $PATTERN ]]; then
|
||||||
echo ::set-output name=tag::${TAG}
|
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=stable-tag::${BASH_REMATCH[1]}
|
echo "stable-tag=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "Tag not recognised, ignoring ..."
|
echo "Tag not recognised, ignoring ..."
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user