Migrate News content #36
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
branches: | |
- trunk | |
push: | |
branches: | |
- trunk | |
jobs: | |
ci: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Rclone | |
uses: AnimMouse/setup-rclone@v1 | |
with: | |
rclone_config: | | |
[remote] | |
type = sftp | |
host = ${{ secrets.FTP_SERVER }} | |
user = ${{ secrets.FTP_USER }} | |
port = ${{ secrets.FTP_PORT }} | |
# Password must be obfuscated using `rclone obfuscate` | |
pass = ${{ secrets.FTP_PASSWORD }} | |
shell_type = unix | |
md5sum_command = none | |
sha1sum_command = none | |
disable_base64: true | |
- name: Calculate cache keys | |
id: get-date | |
run: | | |
echo "day=$(date -u "+%Y-%m-%d")" >> $GITHUB_OUTPUT | |
echo "month=$(date -u "+%Y-%m")" >> $GITHUB_OUTPUT | |
echo "year=$(date -u "+%Y")" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Setup cache | |
uses: actions/cache/[email protected] | |
id: remote | |
with: | |
path: ${{ runner.temp }}/remote | |
key: remote-${{ steps.get-date.outputs.day }} | |
restore-keys: | | |
remote-${{ steps.get-date.outputs.month }}- | |
remote-${{ steps.get-date.outputs.year }}- | |
remote- | |
remote | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Composer install | |
uses: php-actions/composer@v6 | |
with: | |
args: --no-dev --ignore-platform-reqs | |
- name: Download from remote | |
if: steps.remote.outputs.cache-matched-key == '' | |
run: | | |
rclone --exclude-from .ftpignore --copy-links sync remote: ${{ runner.temp }}/remote | |
# Prevent future cache misses if steps further down below are failing | |
- name: Update cache | |
if: steps.remote.outputs.cache-hit != 'true' | |
uses: actions/cache/save@v4 | |
with: | |
path: ${{ runner.temp }}/remote | |
key: ${{ steps.remote.outputs.cache-primary-key }} | |
# Update files from source keeping times of unchanged files | |
- name: Update remote | |
run: | | |
rsync --checksum --copy-links --delete --perms --recursive --verbose ./ ${{ runner.temp }}/remote | |
- name: Dry run upload to remote | |
if: github.ref != 'refs/heads/trunk' | |
run: | | |
rclone -q --exclude-from .ftpignore --copy-links check --combined - ${{ runner.temp }}/remote remote: 2>/dev/null | grep -vE '^= ' | |
- name: Upload to remote | |
if: github.ref == 'refs/heads/trunk' | |
run: | | |
rclone --exclude-from .ftpignore --copy-links sync ${{ runner.temp }}/remote remote: |