Use version from package.json for docker images
This commit is contained in:
23
action.yml
23
action.yml
@@ -356,23 +356,28 @@ branding:
|
||||
color: gray-dark
|
||||
|
||||
# The action will parse its name to check if it's the official action or if it's a forked one
|
||||
# On the official action, it'll use the docker image published on GitHub registry, allowing faster runs
|
||||
# On the official action, it'll use the docker image published on GitHub registry when using a released version, allowing faster runs
|
||||
# On a forked action, it'll rebuild the docker image from Dockerfile
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- run: |
|
||||
# Parse source repository and ref
|
||||
# Parse source repository and version
|
||||
cd $METRICS_ACTION_PATH
|
||||
METRICS_SOURCE=$(echo $METRICS_ACTION | sed -E 's/metrics.*?$//g')
|
||||
METRICS_REF=$(echo $METRICS_ACTION | sed -E 's/^.*metrics//g')
|
||||
echo "Running on $METRICS_SOURCE/metrics@$METRICS_REF"
|
||||
METRICS_VERSION=v$(grep -Po '(?<="version": ")\d+[.]\d+(?=[.]0")' package.json)
|
||||
|
||||
# If using official action, use docker image from GitHub registry
|
||||
if [[ $METRICS_SOURCE == "lowlighter-test-forks" ]]; then
|
||||
echo "Will use docker image from GitHub registry"
|
||||
METRICS_IMAGE=ghcr.io/lowlighter/metrics:$METRICS_REF
|
||||
# On forked actions, rebuild the docker image instead
|
||||
# If using official action, check if a released version is used
|
||||
if [[ $METRICS_SOURCE == "lowlighter" ]]; then
|
||||
if [[ $METRICS_VERSION ]]; then
|
||||
echo "Using released version $METRICS_VERSION, will pull docker image from GitHub registry"
|
||||
METRICS_IMAGE=ghcr.io/lowlighter/metrics:$METRICS_VERSION
|
||||
else
|
||||
echo "This is an unreleased version, rebuilding docker image from Dockerfile"
|
||||
docker build -t metrics:unreleased .
|
||||
METRICS_IMAGE=metrics:unreleased
|
||||
fi
|
||||
# On forked actions, always rebuild the docker image
|
||||
else
|
||||
echo "This is a forked version, rebuilding docker image from Dockerfile"
|
||||
docker build -t metrics:forked .
|
||||
|
||||
@@ -211,7 +211,6 @@
|
||||
//Render metrics
|
||||
const rendered = await metrics({login:user, q, dflags}, {graphql, rest, plugins, conf, die, verify}, {Plugins, Templates})
|
||||
info("Rendering", "complete")
|
||||
console.log(`Render │ complete`)
|
||||
|
||||
//Commit to repository
|
||||
const dryrun = input.bool("dryrun")
|
||||
|
||||
Reference in New Issue
Block a user