On push ⚙️ #3
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: 'Schedule workflow run' | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- images/prestashop/** | |
- images/shopware/** | |
- images/wordpress/** | |
workflow_dispatch: | |
inputs: | |
image: | |
description: 'Image to schedule the workflow for (for testing purposes)' | |
required: true | |
type: choice | |
options: | |
- prestashop | |
- shopware | |
- wordpress | |
jobs: | |
prepare: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
image: | |
- prestashop | |
- shopware | |
- wordpress | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: tj-actions/changed-files@v45 | |
id: changed-files | |
with: | |
files: 'images/${{ matrix.image }}/**' | |
- name: 'Prepare' | |
if: steps.changed-files.outputs.test_any_changed == 'true' || inputs.image == matrix.image | |
id: prepare | |
env: | |
IMAGE: ${{ matrix.image }} | |
shell: bash | |
#language=bash | |
run: | | |
echo "run=true" >> $GITHUB_OUTPUT | |
echo "filename=.lock-$IMAGE.txt" >> $GITHUB_OUTPUT | |
echo "artifact-name=workflow-lock-$IMAGE" >> $GITHUB_OUTPUT | |
- name: 'Check if lock file exists' | |
if: steps.prepare.outputs.run == 'true' | |
uses: ./.github/actions/check-artifact | |
id: check-lock | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
name: ${{ steps.prepare.outputs.artifact-name }} | |
- if: steps.prepare.outputs.run == 'true' && steps.check-lock.outputs.exists == 'true' | |
shell: bash | |
#language=bash | |
run: echo "Lock file already exists." | |
- name: 'Create lock file' | |
if: steps.prepare.outputs.run == 'true' && steps.check-lock.outputs.exists == 'false' | |
env: | |
FILENAME: ${{ steps.prepare.outputs.filename }} | |
shell: bash | |
#language=bash | |
run: | | |
echo "$(date)" > $FILENAME | |
- name: 'Upload lock artifact' | |
uses: actions/upload-artifact@v4 | |
if: steps.prepare.outputs.run == 'true' && steps.check-lock.outputs.exists == 'false' | |
with: | |
name: ${{ steps.prepare.outputs.artifact-name}} | |
path: ${{ steps.prepare.outputs.filename }} |