Browse Source

Merge pull request #1187 from pelias/semantic-release-build-stage

Replace semantic-release dependency with TravisCI build stages
pull/1191/head
Julian Simioni 6 years ago committed by GitHub
parent
commit
66fb60c4d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      .circleci/config.yml
  2. 32
      .circleci/docker.sh
  3. 8
      .travis.yml
  4. 1
      package.json

4
.circleci/config.yml

@ -3,10 +3,10 @@ jobs:
build: build:
working_directory: /app working_directory: /app
docker: docker:
- image: docker:17.05.0-ce-git - image: docker:18.06.1-ce-git
steps: steps:
- checkout - checkout
- setup_remote_docker - setup_remote_docker
- run: - run:
name: Build and push image to Docker Hub name: Build and push image to Docker Hub
command: sh .circleci/docker.sh command: apk --no-cache add curl && curl "https://raw.githubusercontent.com/pelias/ci-tools/master/build-docker-images.sh" | sh -

32
.circleci/docker.sh

@ -1,32 +0,0 @@
#!/bin/bash
set -u
# collect params from ENV vars
DATE=`date +%Y-%m-%d`
DOCKER_REPOSITORY="pelias"
DOCKER_PROJECT="${DOCKER_REPOSITORY}/${CIRCLE_PROJECT_REPONAME}"
BRANCH="$(echo $CIRCLE_BRANCH | tr '/' '-')" #slashes are not valid in docker tags. replace with dashes
# the name of the image that represents the "branch", that is an image that will be updated over time with the git branch
# the production branch is changed to "latest", otherwise the git branch becomes the name of the version
if [[ "${BRANCH}" == "production" ]]; then
DOCKER_BRANCH_IMAGE_VERSION="latest"
else
DOCKER_BRANCH_IMAGE_VERSION="$BRANCH"
fi
DOCKER_BRANCH_IMAGE_NAME="${DOCKER_PROJECT}:${DOCKER_BRANCH_IMAGE_VERSION}"
# the name of the image that represents the "tag", that is an image that is named with the date and git commit and will never be changed
DOCKER_TAG_IMAGE_VERSION="${BRANCH}-${DATE}-${CIRCLE_SHA1}"
DOCKER_TAG_IMAGE_NAME="${DOCKER_PROJECT}:${DOCKER_TAG_IMAGE_VERSION}"
# build image and login to docker hub
docker build -t $DOCKER_PROJECT .
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
# copy the image to each of the two tags, and push
docker tag $DOCKER_PROJECT $DOCKER_BRANCH_IMAGE_NAME
docker tag $DOCKER_PROJECT $DOCKER_TAG_IMAGE_NAME
docker push $DOCKER_BRANCH_IMAGE_NAME
docker push $DOCKER_TAG_IMAGE_NAME

8
.travis.yml

@ -11,8 +11,12 @@ matrix:
script: npm run travis script: npm run travis
before_install: before_install:
- npm i -g npm - npm i -g npm
after_success:
- npx semantic-release
branches: branches:
except: except:
- /^v\d+\.\d+\.\d+$/ - /^v\d+\.\d+\.\d+$/
jobs:
include:
- stage: release
node_js: 10
script: curl "https://raw.githubusercontent.com/pelias/ci-tools/master/semantic-release.sh" | bash -
if: branch = production

1
package.json

@ -75,7 +75,6 @@
"pelias-mock-logger": "^1.3.0", "pelias-mock-logger": "^1.3.0",
"precommit-hook": "^3.0.0", "precommit-hook": "^3.0.0",
"proxyquire": "^2.0.0", "proxyquire": "^2.0.0",
"semantic-release": "^15.1.4",
"source-map": "^0.7.0", "source-map": "^0.7.0",
"tap-dot": "^2.0.0", "tap-dot": "^2.0.0",
"tape": "^4.5.1", "tape": "^4.5.1",

Loading…
Cancel
Save