Update nodejs
, include npm
#41
Workflow file for this run
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
name: Docker | |
on: | |
push: | |
branches: | |
- task/update-npm | |
tags: | |
- v* | |
env: | |
IMAGE_NAME: typo3-base | |
OWNER: rintisch | |
REGISTRY: ghcr.io | |
jobs: | |
# Push image to GitHub Packages. | |
# See also https://docs.docker.com/docker-hub/builds/ | |
push: | |
# Ensure test job passes before pushing image. | |
# needs: test | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Build image | |
run: docker build . --file Dockerfile --tag $IMAGE_NAME | |
- name: Login to GitHub Container Registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login $REGISTRY -u ${{ github.actor }} --password-stdin | |
- name: Push images - same image with different versions (major, minor, patch & latest) | |
run: | | |
IMAGE_ID_LIVE=ghcr.io/$OWNER/$IMAGE_NAME | |
# Change all uppercase to lowercase | |
IMAGE_ID_LIVE=$(echo $IMAGE_ID_LIVE | tr '[A-Z]' '[a-z]') | |
# Strip git ref prefix from version (e.g. `refs/heads/main` becomes `main`) | |
VERSION_RAW=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# Strip "v" prefix from tag name (e.g. `v1.2.0` becomes `1.2.0`) | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION_RAW=$(echo $VERSION_RAW | sed -e 's/^v//') | |
# Test that version number is valid | |
REGEXP='^([0-9]+\.){2}(\*|[0-9]+)$' | |
if [[ $VERSION_RAW =~ $REGEXP ]] | |
then | |
echo "SUCCESS: '$VERSION_RAW' is a valid version number." | |
else | |
echo "ERROR: '$VERSION_RAW' is not a valid version number." | |
exit 1 | |
fi | |
# Create needed version numbers | |
VERSION_ARRAY=( ${VERSION_RAW//./ } ) | |
VERSION_MAIN=${VERSION_ARRAY[0]} | |
VERSION_MINOR=${VERSION_ARRAY[0]}.${VERSION_ARRAY[1]} | |
VERSION_PATCH=${VERSION_ARRAY[0]}.${VERSION_ARRAY[1]}.${VERSION_ARRAY[2]} | |
VERSION_LATEST='latest' | |
echo IMAGE_ID_LIVE = $IMAGE_ID_LIVE | |
echo VERSION_LATEST = $VERSION_LATEST | |
echo VERSION_MAIN = $VERSION_MAIN | |
echo VERSION_MINOR = $VERSION_MINOR | |
echo VERSION_PATCH = $VERSION_PATCH | |
docker image tag $IMAGE_NAME $IMAGE_ID_LIVE:$VERSION_MAIN | |
docker image tag $IMAGE_NAME $IMAGE_ID_LIVE:$VERSION_MINOR | |
docker image tag $IMAGE_NAME $IMAGE_ID_LIVE:$VERSION_PATCH | |
docker image tag $IMAGE_NAME $IMAGE_ID_LIVE:$VERSION_LATEST | |
docker image ls | |
docker image push --all-tags $IMAGE_ID_LIVE |