-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (51 loc) · 1.54 KB
/
docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Publish Docker image
on:
release:
types: [published]
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '0 21 * * 6' # run every Saturday at 21
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
push_to_registries:
name: Push Docker image to docker hub
runs-on: ubuntu-24.04
env:
IMAGE_NAME: ${{ github.repository }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: R setup
uses: r-lib/actions/setup-r@v2
- name: Build package (tarball)
run: R CMD build .
- name: Lint Dockerfile
uses: brpaz/hadolint-action@master
with:
dockerfile: "Dockerfile"
- name: Prepare tags
id: docker_meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push to Docker Hub
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}