-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (33 loc) · 1.14 KB
/
publish-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
name: Publish Docker image
# To maastrichtu-library GitHub Container Registry
# https://github.com/orgs/maastrichtu-library/packages
on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- 'Dockerfile'
- '.github/workflows/publish-docker.yml'
schedule:
- cron: '0 3 * * 1'
# Monday at 3:00 GMT+1
env:
IMAGE_PULLED: postgres:latest
IMAGE_PUSHED: ghcr.io/maastrichtu-library/postgres:latest
jobs:
publish-latest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Log into GitHub Container Registry
# TODO: Create a token with `read:packages` and `write:packages` scopes
# And save it as an Actions secret CONTAINER_REGISTRY_GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Pull image from DockerHub
run: docker pull $IMAGE_PULLED
- name: Push image to GitHub Container Registry
run: |
docker tag $IMAGE_PULLED $IMAGE_PUSHED
docker push $IMAGE_PUSHED
# - name: Build image
# run: docker build . --file Dockerfile --tag $IMAGE_PUSHED