Skip to content

Commit 3db1397

Browse files
committed
Add check-version job
1 parent bec75ab commit 3db1397

File tree

1 file changed

+42
-3
lines changed

1 file changed

+42
-3
lines changed

.github/workflows/deploy-framework.yml

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,53 @@
1-
# When a new Release is created, deploy relevant
1+
# When a new release is created, deploy relevant
22
# files to each of the generated repos.
33
name: Deploy Framework
44

55
on:
6+
workflow_dispatch:
67
release:
78
types: [published]
89

910
jobs:
11+
check-version:
12+
name: Check for updated version
13+
runs-on: ubuntu-22.04
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0 # fetch all tags
20+
21+
- name: Get latest version
22+
run: |
23+
echo 'LATEST_VERSION<<EOF' >> $GITHUB_ENV
24+
echo $(git describe --tags --abbrev=0) | sed "s/v//" >> $GITHUB_ENV
25+
echo 'EOF' >> $GITHUB_ENV
26+
27+
- name: Search for updated version
28+
if: ${{ env.LATEST_VERSION }}
29+
run: |
30+
FILES=("system/CodeIgniter.php" "user_guide_src/source/conf.py")
31+
LENGTH="${#FILES[@]}"
32+
33+
for FILE in "${FILES[@]}"; do
34+
echo "$FILE"
35+
COUNT="$((COUNT + $(grep -c "$FILE" -e "${{ env.LATEST_VERSION }}")))"
36+
done
37+
38+
if [[ $COUNT -ne $LENGTH ]]; then
39+
echo "CodeIgniter version is not updated to v${{ env.LATEST_VERSION }}"
40+
exit 1
41+
fi
42+
43+
echo "CodeIgniter version is updated to v${{ env.LATEST_VERSION }}"
44+
1045
framework:
1146
name: Deploy to framework
1247
if: github.repository == 'codeigniter4/CodeIgniter4'
13-
runs-on: ubuntu-latest
48+
runs-on: ubuntu-22.04
49+
needs: check-version
50+
1451
steps:
1552
- name: Identify
1653
run: |
@@ -55,7 +92,9 @@ jobs:
5592
appstarter:
5693
name: Deploy to appstarter
5794
if: github.repository == 'codeigniter4/CodeIgniter4'
58-
runs-on: ubuntu-latest
95+
runs-on: ubuntu-22.04
96+
needs: check-version
97+
5998
steps:
6099
- name: Identify
61100
run: |

0 commit comments

Comments
 (0)