Skip to content

Commit 7f95f7d

Browse files
committed
Add check-version job
1 parent bec75ab commit 7f95f7d

2 files changed

Lines changed: 50 additions & 3 deletions

File tree

.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: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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

@@ -7,10 +7,34 @@ on:
77
types: [published]
88

99
jobs:
10+
check-version:
11+
name: Check for updated version
12+
runs-on: ubuntu-22.04
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0 # fetch all tags
19+
20+
- name: Get latest version
21+
run: |
22+
echo 'LATEST_VERSION<<EOF' >> $GITHUB_ENV
23+
echo $(git describe --tags --abbrev=0) | sed "s/v//" >> $GITHUB_ENV
24+
echo 'EOF' >> $GITHUB_ENV
25+
26+
- name: Search for updated version
27+
if: ${{ env.LATEST_VERSION }}
28+
run: |
29+
chmod +x ${GITHUB_WORKSPACE}/.github/scripts/validate-version
30+
${GITHUB_WORKSPACE}/.github/scripts/validate-version ${{ env.LATEST_VERSION }}
31+
1032
framework:
1133
name: Deploy to framework
1234
if: github.repository == 'codeigniter4/CodeIgniter4'
13-
runs-on: ubuntu-latest
35+
runs-on: ubuntu-22.04
36+
needs: check-version
37+
1438
steps:
1539
- name: Identify
1640
run: |
@@ -55,7 +79,9 @@ jobs:
5579
appstarter:
5680
name: Deploy to appstarter
5781
if: github.repository == 'codeigniter4/CodeIgniter4'
58-
runs-on: ubuntu-latest
82+
runs-on: ubuntu-22.04
83+
needs: check-version
84+
5985
steps:
6086
- name: Identify
6187
run: |

0 commit comments

Comments
 (0)