Skip to content

Refresh Composer Packages Listing #25806

Refresh Composer Packages Listing

Refresh Composer Packages Listing #25806

name: "Refresh Composer Packages Listing"
on:
schedule:
- cron: '15 * * * *' # Runs only on default branch
push:
branches:
- src
jobs:
setup:
name: Setup, Build and Publish
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- name: Setup Git for later
run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
git config user.email "wp-language-bot@keksi.io"
git config user.name "WP-Languages bot"
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache Composer Dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer Dependencies
uses: php-actions/composer@v6
with:
php_version: 7.4
version: 2
- name: Cache and Build the Repository
uses: php-actions/composer@v6
with:
command: run-script cache-build-ci
- name: Prepare our repository for publishing
run: |
git config --local user.email "wp-language-bot@keksi.io"
git config --local user.name "WP-Languages bot"
git rm -rf .github bin cache config src views README.md composer.*
echo "*" > './.gitignore'
echo "!include/\n!index.html\npackages.json" >> './.gitignore'
git add -f include/* index.html packages.json
git commit -a -m "Automated build"
- name: Publish changes to master branch
uses: ad-m/github-push-action@77c5b412c50b723d2a4fbc6d71fb5723bcd439aa
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: master
force: true
#cleanup:
# if: always()
# needs: [ setup ]
# name: Clean old actions/composer packages
# runs-on: ubuntu-latest
# steps:
# - name: Delete old actions/composer packages
# uses: actions/delete-package-versions@v1
# with:
# package-name: 'php-actions_composer_wp-languages.github.io'