Skip to content

Build and Publish

Build and Publish #12

# From https://event-driven.io/en/how_to_buid_and_push_docker_image_with_github_actions/
name: Build and Publish
on:
# run it on push to the default repository branch
push:
tags:
- '*' # Push events to every tag
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ecomod/rstudio
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}