Skip to content

Commit

Permalink
Create push_dockerhub.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
rmcolq authored Aug 19, 2024
1 parent 0bcc0b6 commit b565a45
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/push_dockerhub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Docker push
# This builds the docker image and pushes it to DockerHub
# Runs on artic-network/rampart repo releases
# and push event to 'dev' branch (PR merges)
on:
push:
branches:
- dev
release:
types: [published]

jobs:
push_dockerhub:
name: Push new Docker image to Docker Hub
runs-on: ubuntu-latest

if: ${{ github.repository == 'artic-network/rampart' }}
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASS: ${{ secrets.DOCKERHUB_PASS }}
steps:
- name: Remove unnecessary files
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Check out pipeline code
uses: actions/checkout@v2

- name: Build new docker image
run: docker build --no-cache . -t articnetworkorg/rampart:latest

- name: Push Docker image to DockerHub (dev)
if: ${{ github.event_name == 'push' }}
run: |
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
docker tag articnetworkorg/rampart:latest articnetworkorg/rampart:dev
docker push articnetworkorg/rampart:dev
- name: Push Docker image to DockerHub (release)
if: ${{ github.event_name == 'release' }}
run: |
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
docker push articnetworkorg/rampart:latest
docker tag articnetworkorg/rampart:latest articnetworkorg/rampart:${{ github.event.release.tag_name }}
docker push articnetworkorg/rampart:${{ github.event.release.tag_name }}

0 comments on commit b565a45

Please sign in to comment.