Skip to content

testing multiple iterations for clearing cache #268

testing multiple iterations for clearing cache

testing multiple iterations for clearing cache #268

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Build and Push to Registry
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
schedule:
- cron: 0 6 * * 1,4
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build-versions:
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.short-sha.outputs.sha }}
date: ${{ steps.date.outputs.date }}
steps:
- uses: actions/checkout@v3
- uses: benjlevesque/[email protected]
id: short-sha
with:
length: 6
- name: Get current date
id: date
run: echo "date=$(date -u +'%Y%m%d')" >> $GITHUB_OUTPUT
latest:
needs: [build-versions, build-images]
strategy:
matrix:
variant: [fpm, fpm-alpine, apache]
version: ['8.3']
latest: ['8']
uses: ./.github/workflows/build.yml
secrets: inherit
with:
version: ${{ matrix.version }}
variant: ${{ matrix.variant }}
tags: |
ghcr.io/${{ github.repository_owner }}/symfony:${{ matrix.variant }}
${{ github.repository_owner }}/symfony:${{ matrix.variant }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ matrix.version }}-${{ matrix.variant }}-${{ needs.build-versions.outputs.date }}
${{ github.repository_owner }}/symfony:${{ matrix.version }}-${{ matrix.variant }}-${{ needs.build-versions.outputs.date }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ matrix.version }}-${{ matrix.variant}}-${{ needs.build-versions.outputs.sha }}
${{ github.repository_owner }}/symfony:${{ matrix.version }}-${{ matrix.variant }}-${{ needs.build-versions.outputs.sha }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ matrix.version }}-${{ matrix.variant }}
${{ github.repository_owner }}/symfony:${{ matrix.version }}-${{ matrix.variant }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ matrix.latest }}-${{ matrix.variant }}-${{ needs.build-versions.outputs.date }}
${{ github.repository_owner }}/symfony:${{ matrix.latest }}-${{ matrix.variant }}-${{ needs.build-versions.outputs.date }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ matrix.latest }}-${{ matrix.variant}}-${{ needs.build-versions.outputs.sha }}
${{ github.repository_owner }}/symfony:${{ matrix.latest }}-${{ matrix.variant }}-${{ needs.build-versions.outputs.sha }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ matrix.latest }}-${{ matrix.variant }}
${{ github.repository_owner }}/symfony:${{ matrix.latest }}-${{ matrix.variant }}
build-images:
needs: build-versions
strategy:
max-parallel: 4
matrix:
variant: [fpm, fpm-alpine, apache]
version: ['8.3', '8.2', '8.1']
uses: ./.github/workflows/build.yml
secrets: inherit
with:
version: ${{ matrix.version }}
variant: ${{ matrix.variant }}
tags: |
ghcr.io/${{ github.repository_owner }}/symfony:${{ matrix.version }}-${{ matrix.variant }}-${{ needs.build-versions.outputs.date }}
${{ github.repository_owner }}/symfony:${{ matrix.version }}-${{ matrix.variant }}-${{ needs.build-versions.outputs.date }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ matrix.version }}-${{ matrix.variant}}-${{ needs.build-versions.outputs.sha }}
${{ github.repository_owner }}/symfony:${{ matrix.version }}-${{ matrix.variant }}-${{ needs.build-versions.outputs.sha }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ matrix.version }}-${{ matrix.variant }}
${{ github.repository_owner }}/symfony:${{ matrix.version }}-${{ matrix.variant }}
clear-cache:
runs-on: ubuntu-latest
needs: ['latest']
steps:
- name: Clear cache
uses: actions/github-script@v7
with:
script: |
console.log("About to clear")
do {
let caches = await github.rest.actions.getActionsCacheList({
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 100,
direction: asc
})
for (let cache of caches.data.actions_caches) {
console.log(cache)
github.rest.actions.deleteActionsCacheById({
owner: context.repo.owner,
repo: context.repo.repo,
cache_id: cache.id,
})
}
} while(caches.data.actions_caches.length > 0)
console.log("Clear completed")