-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
104 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Copyright 2020 ChainSafe Systems | ||
# SPDX-License-Identifier: LGPL-3.0-only | ||
|
||
name: Docker build and push | ||
|
||
on: | ||
push: | ||
branches: | ||
# when main branch receives a push | ||
- crust | ||
# when any of these versions receive a push | ||
tags: | ||
- "v*.*.*" | ||
# when any releases are created | ||
release: | ||
types: | ||
- created | ||
workflow_dispatch: | ||
# list jobs | ||
jobs: | ||
build-and-deploy: | ||
name: Docker Deployment | ||
runs-on: ubuntu-latest | ||
# requires these jobs to run first | ||
# needs: [test, e2e, lint] | ||
# if check not passed, job will be skipped | ||
if: github.ref == 'refs/heads/crust' || contains(github.ref, '/tags/v') | ||
# list steps | ||
steps: | ||
# prepares docker images | ||
- name: Prepare | ||
id: prep | ||
run: | | ||
# creates local variable of chainbridge docker image | ||
DOCKER_IMAGE=crustio/kubo | ||
# creates local variable of commit hash that triggered workflow | ||
COMMIT_HASH=$(echo $GITHUB_SHA | head -c7) | ||
# creates local variable to hold docker images | ||
TAGS="${DOCKER_IMAGE}:${COMMIT_HASH},${DOCKER_IMAGE}:latest" | ||
# check if branch/tag that triggered workflow was from tags | ||
if [[ $GITHUB_REF == refs/tags/* ]]; then | ||
# set version | ||
VERSION=${GITHUB_REF#refs/tags/} | ||
# append version to tags | ||
TAGS="${TAGS},${DOCKER_IMAGE}:${VERSION}" | ||
fi | ||
# sets output of step | ||
echo ::set-output name=tags::${TAGS} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.prep.outputs.tags }} | ||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters