Build on snapshot changed #28988
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: Build on snapshot changed | |
permissions: | |
contents: none | |
on: | |
repository_dispatch: | |
types: run-cron | |
workflow_dispatch: | |
schedule: | |
- cron: "*/30 * * * *" | |
jobs: | |
run-cron: | |
name: Build on snapshot changed | |
environment: | |
name: Trigger snapshot update | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { version-range: "5.2", pre-release: false, is-latest: true } | |
- { version-range: "6.0", pre-release: true, is-latest: false } | |
steps: | |
- name: Fetch hash file | |
run: "curl -f -v -o snapshot.json -H 'Cache-Control: no-cache, no-store' -H 'User-Agent: phpmyadmin-snapshot-updater (+https://github.com/sudo-bot/docker-phpmyadmin-snapshots; williamdes@wdes.fr)' -s https://files.phpmyadmin.net/snapshots/phpMyAdmin-${{ matrix.version-range }}%2Bsnapshot.json" | |
- name: Display file | |
run: cat ./snapshot.json | |
- name: Commit to variable | |
run: echo "snapshot_commit=$(jq -r '.commit' ./snapshot.json)" >> $GITHUB_ENV | |
- name: Date to variable | |
run: echo "snapshot_date=$(jq -r '.date' ./snapshot.json)" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
id: cache | |
with: | |
path: snapshot.json | |
key: snapshot-${{ matrix.version-range }}-${{ env.snapshot_commit }}-${{ env.snapshot_date }} | |
- name: Checkout repository | |
if: steps.cache.outputs.cache-hit != 'true' | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
ref: 'main' | |
path: repo | |
token: ${{ secrets.SUDO_BOT_TOKEN }} | |
# Already the default value, but so you understand the push command will have creds | |
persist-credentials: true | |
- name: Import GPG key | |
if: steps.cache.outputs.cache-hit != 'true' | |
# v6.2.0 - cb9bde2e2525e640591a934b1fd28eef1dcaf5e5 | |
uses: crazy-max/ghaction-import-gpg@cb9bde2e2525e640591a934b1fd28eef1dcaf5e5 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
workdir: ./repo | |
- name: Trigger a build for ${{ matrix.version-range }} | |
if: steps.cache.outputs.cache-hit != 'true' | |
working-directory: ./repo | |
id: create-release | |
run: ./make-release.sh --env=${{ matrix.version-range }} -p | |
- name: Create a Release | |
if: steps.cache.outputs.cache-hit != 'true' | |
working-directory: ./repo | |
run: ./create-github-release.sh "${{ matrix.version-range }}" "${{ matrix.pre-release }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.SUDO_BOT_TOKEN }} | |
TAG_NAME: ${{ steps.create-release.outputs.TAG_NAME }} | |
NAME: ${{ matrix.version-range }} series | |
BODY: "Updated ${{ matrix.version-range }} series to https://github.com/phpmyadmin/phpmyadmin/commit/${{ env.snapshot_commit }} built on ${{ env.snapshot_date }}" | |
PRE_RELEASE: ${{ matrix.pre-release }} | |
MAKE_LATEST: ${{ matrix.is-latest }} | |
REPO_OWNER: ${{ github.repository_owner }} | |
REPO_NAME: ${{ github.event.repository.name }} | |
- name: Set the summary | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: echo "Updated ${{ matrix.version-range }} to https://github.com/phpmyadmin/phpmyadmin/commit/${{ env.snapshot_commit }} built on ${{ env.snapshot_date }}" >> $GITHUB_STEP_SUMMARY |