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@v4 |
---|
33 | |
---|
34 | - name: Login to GitHub Container Registry |
---|
35 | uses: docker/login-action@v3 |
---|
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@v6 |
---|
43 | env: |
---|
44 | DOCKER_BUILD_NO_SUMMARY: true |
---|
45 | with: |
---|
46 | context: . |
---|
47 | file: dev/shared-assets-sync/Dockerfile |
---|
48 | push: true |
---|
49 | tags: ghcr.io/ietf-tools/datatracker-rsync-assets:latest |
---|
50 | |
---|
51 | sync: |
---|
52 | name: Run assets rsync |
---|
53 | if: ${{ always() }} |
---|
54 | runs-on: [self-hosted, dev-server] |
---|
55 | needs: [build] |
---|
56 | steps: |
---|
57 | - name: Run rsync |
---|
58 | env: |
---|
59 | DEBIAN_FRONTEND: noninteractive |
---|
60 | run: | |
---|
61 | docker pull ghcr.io/ietf-tools/datatracker-rsync-assets:latest |
---|
62 | docker run --rm -v dt-assets:/assets ghcr.io/ietf-tools/datatracker-rsync-assets:latest |
---|
63 | docker image prune -a -f |
---|