-
Notifications
You must be signed in to change notification settings - Fork 235
98 lines (87 loc) · 2.83 KB
/
depends.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Docker Depends Image
on:
push:
branches:
- develop
- master
workflow_dispatch:
# this runs on the develop branch
schedule:
- cron: '0 0 * * *' # midnight daily
- cron: '30 1 * * 1' # 1:30 AM every Monday (devel only)
env:
# official supported version of R
SUPPORTED: 4.1
DOCKERHUB_ORG: pecan
jobs:
depends:
if: github.repository == 'PecanProject/pecan'
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
strategy:
fail-fast: false
matrix:
R:
- "4.1"
- "4.2"
- "4.3"
- "devel"
steps:
- name: Work around https://github.com/actions/checkout/issues/766
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/checkout@v4
with:
set-safe-directory: false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker
buildkitd-flags: --debug
install: true
# calculate some variables that are used later
- name: github branch
# build Rdevel only on Mondays, others every day (but not twice on Mondays)
if: |
github.event_name == 'workflow_dispatch' ||
(matrix.R != 'devel' && github.event.schedule == '0 0 * * *') ||
(matrix.R == 'devel' && github.event.schedule == '30 1 * * 1')
run: |
BRANCH=${GITHUB_REF##*/}
echo "GITHUB_BRANCH=${BRANCH}" >> $GITHUB_ENV
tags="R${{ matrix.R }}"
if [ "${{ matrix.R }}" == "${{ env.SUPPORTED }}" ]; then
if [ "$BRANCH" == "master" ]; then
tags="${tags},latest"
elif [ "$BRANCH" == "develop" ]; then
tags="${tags},develop"
fi
fi
echo "TAG=${tags}" >> $GITHUB_ENV
# this will publish to the actor (person) github packages
- name: Publish to GitHub
if: env.TAG != ''
uses: elgohr/Publish-Docker-Github-Action@v5
env:
R_VERSION: ${{ matrix.R }}
with:
name: ${{ github.repository_owner }}/pecan/depends
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
context: docker/depends
tags: "${{ env.TAG }}"
registry: docker.pkg.github.com
buildargs: R_VERSION
# this will publish to the clowder dockerhub repo
- name: Publish to Docker Hub
if: env.TAG != ''
uses: elgohr/Publish-Docker-Github-Action@v5
env:
R_VERSION: ${{ matrix.R }}
with:
name: ${{ env.DOCKERHUB_ORG }}/depends
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
context: docker/depends
tags: "${{ env.TAG }}"
buildargs: R_VERSION