Skip to content

Commit

Permalink
Docker build/push ... try #1
Browse files Browse the repository at this point in the history
  • Loading branch information
jacogr committed Jun 10, 2020
1 parent 5557e47 commit c9104db
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
14 changes: 13 additions & 1 deletion .github/workflows/push-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
40 changes: 40 additions & 0 deletions scripts/docker.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c9104db

Please sign in to comment.