forked from Koodimonni/koodimonni.github.io
-
Notifications
You must be signed in to change notification settings - Fork 11
74 lines (64 loc) · 2.37 KB
/
refresh-listing.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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'