refactor: move timestamp into dedicated job
Provides a unique timestamp across all jobs. PR: zmkfirmware/zmk-docker#74
This commit is contained in:
parent
f0b02aecfd
commit
406388461c
13
.github/workflows/containers.yml
vendored
13
.github/workflows/containers.yml
vendored
@ -24,6 +24,14 @@ on:
|
|||||||
concurrency: ${{ github.ref }}/${{ github.workflow }}
|
concurrency: ${{ github.ref }}/${{ github.workflow }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
timestamp:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
timestamp: ${{ steps.timestamp.outputs.timestamp }}
|
||||||
|
steps:
|
||||||
|
- name: Timestamp
|
||||||
|
id: timestamp
|
||||||
|
run: echo ::set-output name=timestamp::$(date +%Y%m%d%H%M%S)
|
||||||
architectures:
|
architectures:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
@ -40,6 +48,8 @@ jobs:
|
|||||||
architectures = yaml.safe_load(file)
|
architectures = yaml.safe_load(file)
|
||||||
print('::set-output name=json::' + json.dumps(architectures))
|
print('::set-output name=json::' + json.dumps(architectures))
|
||||||
tags:
|
tags:
|
||||||
|
needs:
|
||||||
|
- timestamp
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
branch: ${{ steps.definitions.outputs.branch }}
|
branch: ${{ steps.definitions.outputs.branch }}
|
||||||
@ -52,6 +62,7 @@ jobs:
|
|||||||
- name: Definitions
|
- name: Definitions
|
||||||
id: definitions
|
id: definitions
|
||||||
env:
|
env:
|
||||||
|
TIMESTAMP: ${{ needs.timestamp.outputs.timestamp }}
|
||||||
SHA: ${{ github.sha }}
|
SHA: ${{ github.sha }}
|
||||||
SHA_ABBREV_LENGTH: ${{ env.sha-abbrev-length }}
|
SHA_ABBREV_LENGTH: ${{ env.sha-abbrev-length }}
|
||||||
RUN_ID: ${{ github.run_id }}
|
RUN_ID: ${{ github.run_id }}
|
||||||
@ -62,7 +73,7 @@ jobs:
|
|||||||
BRANCH=${BRANCH//[^A-Za-z0-9_.-]/_} # Substitutes invalid Docker tag characters
|
BRANCH=${BRANCH//[^A-Za-z0-9_.-]/_} # Substitutes invalid Docker tag characters
|
||||||
BASE=${GITHUB_BASE_REF//[^A-Za-z0-9_.-]/_} # Substitutes invalid Docker tag characters
|
BASE=${GITHUB_BASE_REF//[^A-Za-z0-9_.-]/_} # Substitutes invalid Docker tag characters
|
||||||
SHA=${SHA:0:${SHA_ABBREV_LENGTH}}
|
SHA=${SHA:0:${SHA_ABBREV_LENGTH}}
|
||||||
CANDIDATE=${BRANCH}-$(date +%Y%m%d%H%M%S)-${ZEPHYR_VERSION}-${ZEPHYR_SDK_VERSION}-${SHA}-${RUN_ID}
|
CANDIDATE=${BRANCH}-${TIMESTAMP}-${ZEPHYR_VERSION}-${ZEPHYR_SDK_VERSION}-${SHA}-${RUN_ID}
|
||||||
VERSIONS=${ZEPHYR_VERSION}-${ZEPHYR_SDK_VERSION}
|
VERSIONS=${ZEPHYR_VERSION}-${ZEPHYR_SDK_VERSION}
|
||||||
MAJOR=$(echo ${ZEPHYR_VERSION} | cut -d'.' -f 1)
|
MAJOR=$(echo ${ZEPHYR_VERSION} | cut -d'.' -f 1)
|
||||||
MINOR=$(echo ${ZEPHYR_VERSION} | cut -d'.' -f 2)
|
MINOR=$(echo ${ZEPHYR_VERSION} | cut -d'.' -f 2)
|
||||||
|
Loading…
Reference in New Issue
Block a user