Skip to content

fixes to disable JS9 by default #185

fixes to disable JS9 by default

fixes to disable JS9 by default #185

name: Docker
on:
push:
# Publish `master` as Docker `latest` image and `bX.Y` as X.Y.
branches:
- master
- b*
# # Publish `v1.2.3` tags as releases.
tags:
- v*
release:
types: [published]
# Run tests for any PRs.
pull_request:
env:
IMAGE_NAME: osmirnov/radiopadre
REGISTRY: quay.io
jobs:
# Run tests.
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run tests
run: |
if [ -f docker-compose.test.yml ]; then
docker-compose --file docker-compose.test.yml build
docker-compose --file docker-compose.test.yml run sut
else
docker build . --file Dockerfile
fi
# 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:
- uses: actions/checkout@v2
- name: Log into docker registry
# TODO: Create a PAT with `read:packages` and `write:packages` scopes and save it as an Actions secret `CR_PAT`
run: echo "${{ secrets.QUAYIO_TOKEN }}" | docker login -u="osmirnov+radiopadre_github_ci" --password-stdin $REGISTRY
- name: Build image
run: |
echo github.ref="${{ github.ref }}"
echo IMAGE_NAME=$IMAGE_NAME
docker build . --file Dockerfile --tag $IMAGE_NAME
- name: Push image to docker registry
run: |
IMAGE_ID=$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
RELEASE=""
echo github.ref="github ref is '${{ github.ref }}'"
# Strip "v" prefix from tag name
if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
VERSION=$(echo $VERSION | sed -e 's/^v//')
RELEASE=$(echo $VERSION | sed -e 's/\.[0-9]*$/.latest/')
echo "Release $RELEASE"
elif [[ "${{ github.ref }}" == "refs/heads/b"* ]]; then
VERSION=$(echo $VERSION | sed -e 's/^b//')
RELEASE=""
echo "Branch $VERSION: not release"
if [ "${VERSION%.x}" != "$VERSION" ]; then
VERSION="${VERSION%.x}.pre1"
echo "Image name will be $VERSION"
fi
else
echo "Branch ${{ github.ref }} is neither branch nor release"
fi
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $REGISTRY/$IMAGE_ID:$VERSION
docker push $REGISTRY/$IMAGE_ID:$VERSION
if [ "$RELEASE" != "" ]; then
docker tag $IMAGE_NAME $REGISTRY/$IMAGE_ID:$RELEASE
docker push $REGISTRY/$IMAGE_ID:$RELEASE
fi