-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Trigger docker-deploy only for release events - Use docker/build-push-action to publish the docker image - Remove scripts/deploy_docker.sh – this script relied on builds from the branches develop and master. For tags, it would pull the latest staging image and tag it (which we don't want since we want to build the tag and deploy it)
- Loading branch information
Showing
2 changed files
with
36 additions
and
37 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 |
---|---|---|
|
@@ -75,26 +75,43 @@ jobs: | |
docker-deploy: | ||
runs-on: ubuntu-latest | ||
needs: test-app | ||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/') | ||
if: github.event_name == 'release' && github.event.action == 'released' | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Dockerhub login | ||
uses: docker/login-action@v1 | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
- name: Set up Docker Buildx | ||
uses: docker/[email protected] | ||
- name: Cache Docker layers | ||
uses: actions/[email protected] | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Set tag (release) | ||
# Set the tag versions as Docker tag if it is a release event | ||
if: github.event_name == 'release' && github.event.action == 'released' | ||
run: echo "DOCKER_TAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV | ||
- name: Login to DockerHub | ||
uses: docker/[email protected] | ||
with: | ||
username: ${{ secrets.DOCKER_USER }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- name: Deploy Master | ||
if: github.ref == 'refs/heads/master' | ||
run: bash scripts/deploy_docker.sh staging | ||
env: | ||
DOCKERHUB_PROJECT: safe-notification-service | ||
- name: Deploy Develop | ||
if: github.ref == 'refs/heads/develop' | ||
run: bash scripts/deploy_docker.sh develop | ||
env: | ||
DOCKERHUB_PROJECT: safe-notification-service | ||
- name: Deploy Tag | ||
if: startsWith(github.ref, 'refs/tags/') | ||
run: bash scripts/deploy_docker.sh ${GITHUB_REF##*/} | ||
env: | ||
DOCKERHUB_PROJECT: safe-notification-service | ||
- name: Build and push | ||
id: docker_build | ||
uses: docker/[email protected] | ||
with: | ||
context: . | ||
push: true | ||
tags: gnosispm/safe-notification-service:${{ env.DOCKER_TAG }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache-new | ||
- # Temp fix | ||
# https://github.com/docker/build-push-action/issues/252 | ||
# https://github.com/moby/buildkit/issues/1896 | ||
name: Move cache | ||
run: | | ||
rm -rf /tmp/.buildx-cache | ||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | ||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} |
This file was deleted.
Oops, something went wrong.