Skip to content

Commit 460b8a4

Browse files
committed
Add check-version job
1 parent bec75ab commit 460b8a4

File tree

2 files changed

+51
-3
lines changed

2 files changed

+51
-3
lines changed

.github/scripts/validate-version

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
set -o pipefail
3+
4+
if [[ -z $1 ]]; then
5+
echo "validate-version requires a version identifier"
6+
exit 1
7+
fi
8+
9+
FILES=("system/CodeIgniter.php" "user_guide_src/source/conf.py")
10+
LENGTH="${#FILES[@]}"
11+
12+
for FILE in "${FILES[@]}"; do
13+
COUNT="$((COUNT + $(grep -c "$FILE" -e "$1")))"
14+
done
15+
16+
if [[ $COUNT -ne $LENGTH ]]; then
17+
echo "CodeIgniter version is not updated to v"$1""
18+
exit 1
19+
fi
20+
21+
echo "CodeIgniter version is updated to v"$1""

.github/workflows/deploy-framework.yml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,41 @@
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+
chmod +x ${GITHUB_WORKSPACE}/.github/scripts/validate-version
31+
${GITHUB_WORKSPACE}/.github/scripts/validate-version ${{ env.LATEST_VERSION }}
32+
1033
framework:
1134
name: Deploy to framework
1235
if: github.repository == 'codeigniter4/CodeIgniter4'
13-
runs-on: ubuntu-latest
36+
runs-on: ubuntu-22.04
37+
needs: check-version
38+
1439
steps:
1540
- name: Identify
1641
run: |
@@ -55,7 +80,9 @@ jobs:
5580
appstarter:
5681
name: Deploy to appstarter
5782
if: github.repository == 'codeigniter4/CodeIgniter4'
58-
runs-on: ubuntu-latest
83+
runs-on: ubuntu-22.04
84+
needs: check-version
85+
5986
steps:
6087
- name: Identify
6188
run: |

0 commit comments

Comments
 (0)