Last active
August 5, 2024 17:53
-
-
Save Duologic/c79dafe24652455a3da7b35ea703340a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Run like this: `eval $(jsonnet -S <this file>)` | |
// | |
// versions.libsonnet has entries like this: | |
// { | |
// cacheRestore: { | |
// version: 'v4.0.2', | |
// sha: '0c45773b623bea8c8e75f6c82b208c3cf94ea4f9', | |
// action: 'actions/cache/restore', | |
// }, | |
// ... | |
// } | |
local versions = import 'versions.libsonnet'; | |
local sed(file, needle, replacement) = | |
"sed -i 's;" + needle + ';' + replacement + ";' " + file; | |
local commands(file) = [ | |
sed( | |
file, | |
'uses: ' + versions[v].action + '@.*', | |
'uses: ' + versions[v].action + '@' + versions[v].sha + ' # ' + versions[v].version, | |
) | |
for v in std.objectFields(versions) | |
if 'version' in versions[v] | |
]; | |
std.join( | |
';', | |
commands('../workflows/workflow1.yaml') | |
+ commands('../workflows/workflow2.yaml') | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment