Skip to content

Commit 83771ac

Browse files
committed
ci: scheduled shared assets rsync
1 parent 220be21 commit 83771ac

2 files changed

Lines changed: 70 additions & 0 deletions

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# GITHUB ACTIONS - WORKFLOW
2+
3+
# RSync the assets in the shared assets volume
4+
5+
name: Nightly Dev Shared Assets Sync
6+
7+
# Controls when the workflow will run
8+
on:
9+
# Run every night
10+
schedule:
11+
- cron: '0 1 * * *'
12+
13+
# Run on app-rsync-extras.sh changes
14+
push:
15+
branches:
16+
- main
17+
paths:
18+
- 'docker/scripts/app-rsync-extras.sh'
19+
20+
# Allows you to run this workflow manually from the Actions tab
21+
workflow_dispatch:
22+
23+
jobs:
24+
build:
25+
name: Build Docker Image
26+
runs-on: ubuntu-latest
27+
if: ${{ github.event_name != 'schedule' }}
28+
permissions:
29+
contents: read
30+
packages: write
31+
steps:
32+
- uses: actions/checkout@v3
33+
34+
- name: Login to GitHub Container Registry
35+
uses: docker/login-action@v2
36+
with:
37+
registry: ghcr.io
38+
username: ${{ github.actor }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Docker Build & Push
42+
uses: docker/build-push-action@v3
43+
with:
44+
context: .
45+
file: dev/shared-assets-sync/Dockerfile
46+
push: true
47+
tags: ghcr.io/ietf-tools/datatracker-rsync-assets:latest
48+
49+
sync:
50+
name: Run assets rsync
51+
if: ${{ always() }}
52+
runs-on: dev-server
53+
needs: [build]
54+
steps:
55+
- name: Run rsync
56+
env:
57+
DEBIAN_FRONTEND: noninteractive
58+
run: |
59+
docker pull ghcr.io/ietf-tools/datatracker-rsync-assets:latest
60+
docker run --rm -v dt-assets:/assets ghcr.io/ietf-tools/datatracker-rsync-assets:latest
61+
docker image prune -a -f

dev/shared-assets-sync/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM alpine:3
2+
3+
RUN apk add --no-cache wget rsync
4+
COPY docker/scripts/app-rsync-extras.sh /workspace/app-rsync-extras.sh
5+
RUN chmod +x /workspace/app-rsync-extras.sh
6+
7+
WORKDIR /workspace
8+
9+
CMD ["sh", "app-rsync-extras.sh"]

0 commit comments

Comments
 (0)