-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (76 loc) · 3.82 KB
/
cron.yml
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
75
76
77
78
79
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