Skip to content
Permalink
Browse files

Automatically update docker images upon release (#318)

  • Loading branch information...
alexarchambault committed Feb 15, 2019
1 parent f11b51f commit 7a9392d8023f76d5bb9d464a3432457d0c273eda
Showing with 56 additions and 2 deletions.
  1. +5 −0 .travis.yml
  2. +2 −2 project/Settings.scala
  3. +49 −0 scripts/update-docker-images.sh
@@ -17,6 +17,8 @@ stages:
if: (branch = master AND type = push) OR (tag IS present)
- name: upload-launcher
if: tag IS present
- name: update-docker-images # after upload-launcher, that waited for the sync to Maven Central
if: tag IS present
- name: update-versioned-docs
if: tag IS present
- name: update-website
@@ -49,6 +51,9 @@ jobs:
- stage: upload-launcher
name: "Upload launcher"
script: scripts/upload-launcher.sh
- stage: update-docker-images
name: "Update docker images"
script: scripts/update-docker-images.sh
- stage: update-versioned-docs
env: WEBSITE_DIR=docs/website VERSIONED_DOCS_REPO=almond-sh/versioned-docs
script:
@@ -7,8 +7,8 @@ import sbt.Keys._

object Settings {

private val scala211 = "2.11.12"
private val scala212 = "2.12.8"
def scala211 = "2.11.12"
def scala212 = "2.12.8"

lazy val isAtLeast212 = Def.setting {
CrossVersion.partialVersion(scalaVersion.value) match {
@@ -0,0 +1,49 @@
#!/usr/bin/env bash
set -euv

SCALA212_VERSION="$(grep -oP '(?<=def scala212 = ")[^"]*(?<!")' project/Settings.scala)"
SCALA211_VERSION="$(grep -oP '(?<=def scala211 = ")[^"]*(?<!")' project/Settings.scala)"

VERSION="$(git describe --tags --abbrev=0 --match 'v*' | sed 's/^v//')"

mkdir -p target
cd target

git clone "https://$GH_TOKEN@github.com/almond-sh/docker-images.git" -b template
cd docker-images

BRANCHES=()

for sv in "$SCALA211_VERSION" "$SCALA212_VERSION"; do

BRANCH="almond-$VERSION-scala-$sv"
git checkout -b "$BRANCH" template
BRANCHES+=("$BRANCH")

mv Dockerfile Dockerfile.tmp
cat Dockerfile.tmp |
sed 's@{SCALA_VERSION}@'"$sv"'@g' |
sed 's@{VERSION}@'"$VERSION"'@g' > Dockerfile
rm -f Dockerfile.tmp

git add Dockerfile
git commit -m "almond $VERSION, scala $sv"
done

DEFAULT_BRANCH="almond-$VERSION-scala-$SCALA212_VERSION"

BRANCH="almond-$VERSION"
git checkout -b "$BRANCH" "$DEFAULT_BRANCH"
BRANCHES+=("$BRANCH")

BRANCH="latest"
git checkout -b "$BRANCH" "$DEFAULT_BRANCH"
BRANCHES+=("$BRANCH")

for b in "${BRANCHES[@]}"; do
if [ "$b" = "latest" ]; then
git push -f origin "$b"
else
git push origin "$b"
fi
done

0 comments on commit 7a9392d

Please sign in to comment.
You can’t perform that action at this time.