[build] Fix cache warmer (#14261)

Fix 50136eeeb3

Authored by: bashonly
pull/14232/head^2
bashonly 3 days ago committed by GitHub
parent 48a214bef4
commit 8597a4331e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -9,6 +9,9 @@ on:
required: false required: false
default: stable default: stable
type: string type: string
origin:
required: true
type: string
unix: unix:
default: true default: true
type: boolean type: boolean
@ -27,10 +30,6 @@ on:
windows: windows:
default: true default: true
type: boolean type: boolean
origin:
required: false
default: ''
type: string
secrets: secrets:
GPG_SIGNING_KEY: GPG_SIGNING_KEY:
required: false required: false
@ -74,13 +73,6 @@ on:
description: yt-dlp.exe, yt-dlp_win.zip, yt-dlp_x86.exe, yt-dlp_win_x86.zip, yt-dlp_arm64.exe, yt-dlp_win_arm64.zip description: yt-dlp.exe, yt-dlp_win.zip, yt-dlp_x86.exe, yt-dlp_win_x86.zip, yt-dlp_arm64.exe, yt-dlp_win_arm64.zip
default: true default: true
type: boolean type: boolean
origin:
description: Origin
required: false
default: 'current repo'
type: choice
options:
- 'current repo'
permissions: permissions:
contents: read contents: read
@ -89,25 +81,24 @@ jobs:
process: process:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
origin: ${{ steps.process_origin.outputs.origin }} origin: ${{ steps.process_inputs.outputs.origin }}
timestamp: ${{ steps.process_origin.outputs.timestamp }} timestamp: ${{ steps.process_inputs.outputs.timestamp }}
version: ${{ steps.process_origin.outputs.version }} version: ${{ steps.process_inputs.outputs.version }}
steps: steps:
- name: Process origin - name: Process inputs
id: process_origin id: process_inputs
env: env:
ORIGIN: ${{ inputs.origin }} INPUTS: ${{ toJSON(inputs) }}
REPOSITORY: ${{ github.repository }} REPOSITORY: ${{ github.repository }}
VERSION: ${{ inputs.version }}
shell: python shell: python
run: | run: |
import datetime as dt import datetime as dt
import json import json
import os import os
import re import re
origin = os.environ['ORIGIN'] INPUTS = json.loads(os.environ['INPUTS'])
timestamp = dt.datetime.now(tz=dt.timezone.utc).strftime('%Y.%m.%d.%H%M%S.%f') timestamp = dt.datetime.now(tz=dt.timezone.utc).strftime('%Y.%m.%d.%H%M%S.%f')
version = os.getenv('VERSION') version = INPUTS.get('version')
if version and '.' not in version: if version and '.' not in version:
# build.yml was dispatched with only a revision as the version input value # build.yml was dispatched with only a revision as the version input value
version_parts = [*timestamp.split('.')[:3], version] version_parts = [*timestamp.split('.')[:3], version]
@ -119,7 +110,7 @@ jobs:
version_parts = version.split('.') version_parts = version.split('.')
assert all(re.fullmatch(r'[0-9]+', part) for part in version_parts), 'Version must be numeric' assert all(re.fullmatch(r'[0-9]+', part) for part in version_parts), 'Version must be numeric'
outputs = { outputs = {
'origin': os.environ['REPOSITORY'] if origin == 'current repo' else origin, 'origin': INPUTS.get('origin') or os.environ['REPOSITORY'],
'timestamp': timestamp, 'timestamp': timestamp,
'version': '.'.join(version_parts), 'version': '.'.join(version_parts),
} }

@ -12,6 +12,7 @@ jobs:
with: with:
version: '999999' version: '999999'
channel: stable channel: stable
origin: ${{ github.repository }}
unix: false unix: false
linux: false linux: false
linux_armv7l: true linux_armv7l: true

Loading…
Cancel
Save