Docker build/push ... try #1

This commit is contained in:
Jaco Greeff 2020-06-10 21:35:04 +02:00
parent 5557e47185
commit c9104dbe32
2 changed files with 53 additions and 1 deletions

View File

@ -31,6 +31,19 @@ jobs:
yarn install --immutable | grep -v 'YN0013'
yarn ${{ matrix.step }}
# only run on "CI skip", i.e. when the actual version has been bumped to release/stable
docker:
name: docker
if: "startsWith(github.event.head_commit.message, '[CI Skip] release/') && github.repository == 'polkadot-js/apps'"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: docker
env:
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
run: |
./scripts/docker.sh
# only run on "CI skip", i.e. when the actual version has been bumped to release/stable
electron:
strategy:
@ -49,7 +62,6 @@ jobs:
run: |
mkdir -p ~/private_keys/
echo '${{ secrets.API_KEY }}' > ~/private_keys/AuthKey_${{ secrets.API_KEY_ID }}.p8
- name: Build/release Electron app
uses: samuelmeuli/action-electron-builder@v1
with:

40
scripts/docker.sh Normal file
View File

@ -0,0 +1,40 @@
#!/user/bin/env bash
# Copyright 2017-2020 @polkadot/apps authors & contributors
# This software may be modified and distributed under the terms
# of the Apache-2.0 license. See the LICENSE file for details.
# fail fast on any non-zero exits
set -e
# the docker image name and dockerhub repo
NAME="polkadot-js-apps"
REPO="jacogr"
# extract the current npm version from package.json
VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g' \
| sed 's/ //g')
# helper function for the build logic
function build () {
echo "*** Building $NAME"
docker build -t $NAME .
}
# helper function for the publishing logic
function publish () {
docker login -u $REPO -p $DOCKER_PASS
echo "*** Tagging $REPO/$NAME"
docker tag $NAME $REPO/$NAME:$VERSION
docker tag $NAME $REPO/$NAME
echo "*** Publishing $NAME"
docker push $REPO/$NAME
}
build
publish