ci: scheduled shared assets rsync
This commit is contained in:
parent
220be21998
commit
83771aceb3
61
.github/workflows/dev-assets-sync-nightly.yml
vendored
Normal file
61
.github/workflows/dev-assets-sync-nightly.yml
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
# GITHUB ACTIONS - WORKFLOW
|
||||
|
||||
# RSync the assets in the shared assets volume
|
||||
|
||||
name: Nightly Dev Shared Assets Sync
|
||||
|
||||
# Controls when the workflow will run
|
||||
on:
|
||||
# Run every night
|
||||
schedule:
|
||||
- cron: '0 1 * * *'
|
||||
|
||||
# Run on app-rsync-extras.sh changes
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'docker/scripts/app-rsync-extras.sh'
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Docker Image
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event_name != 'schedule' }}
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Docker Build & Push
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
file: dev/shared-assets-sync/Dockerfile
|
||||
push: true
|
||||
tags: ghcr.io/ietf-tools/datatracker-rsync-assets:latest
|
||||
|
||||
sync:
|
||||
name: Run assets rsync
|
||||
if: ${{ always() }}
|
||||
runs-on: dev-server
|
||||
needs: [build]
|
||||
steps:
|
||||
- name: Run rsync
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
run: |
|
||||
docker pull ghcr.io/ietf-tools/datatracker-rsync-assets:latest
|
||||
docker run --rm -v dt-assets:/assets ghcr.io/ietf-tools/datatracker-rsync-assets:latest
|
||||
docker image prune -a -f
|
9
dev/shared-assets-sync/Dockerfile
Normal file
9
dev/shared-assets-sync/Dockerfile
Normal file
|
@ -0,0 +1,9 @@
|
|||
FROM alpine:3
|
||||
|
||||
RUN apk add --no-cache wget rsync
|
||||
COPY docker/scripts/app-rsync-extras.sh /workspace/app-rsync-extras.sh
|
||||
RUN chmod +x /workspace/app-rsync-extras.sh
|
||||
|
||||
WORKDIR /workspace
|
||||
|
||||
CMD ["sh", "app-rsync-extras.sh"]
|
Loading…
Reference in a new issue