-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (41 loc) · 1.43 KB
/
docker-r.yaml
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
name: Build & Publish R Docker
on:
push:
paths:
- environment/r/Dockerfile
- environment/r/requirements.txt
- .github/workflows/docker-r.yaml
jobs:
docker:
name: Build & Publish R Docker
runs-on: ubuntu-latest
strategy:
matrix:
registry:
- docker.pkg.github.com
env:
IMAGE_NAME: '${{ matrix.registry }}/${{ github.repository }}/${{ github.event.repository.name }}-r'
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set Environment Variables
shell: bash
run: |
echo "IMAGE_VERSION=$(date --utc --iso-8601)_${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Build Docker image
working-directory: environment/r
run: |
docker build \
--tag ${{ env.IMAGE_NAME }}:latest \
--tag ${{ env.IMAGE_NAME }}:${{ env.IMAGE_VERSION }} \
.
- name: Publish Image
if: github.ref == 'refs/heads/master' && github.event_name == 'push' && !github.event.repository.fork
# https://help.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-docker-for-use-with-github-packages
run: |
docker login \
--username ${{ github.event.repository.name }} \
--password ${{ secrets.GITHUB_TOKEN }} \
${{ matrix.registry }}
docker push ${{ env.IMAGE_NAME }}:latest
docker push ${{ env.IMAGE_NAME }}:${{ env.IMAGE_VERSION }}