Skip to content

Commit 88d751f

Browse files
committed
up: add action tests on php 8.1
1 parent 7d05bd0 commit 88d751f

File tree

2 files changed

+73
-1
lines changed

2 files changed

+73
-1
lines changed

.github/workflows/php.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
fail-fast: true
2020
matrix:
21-
php: [7.4, 8.0] # 7.2, 7.3,
21+
php: [7.4, 8.0, 8.1] # 7.2, 7.3,
2222
os: [ubuntu-latest, macOS-latest] # windows-latest,
2323
# include: # will not testing on php 7.2
2424
# - os: 'ubuntu-latest'
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# GitHub Actions Workflow responsible for cleaning up the template repository from
2+
# the template-specific files and configurations. This workflow is supposed to be triggered automatically
3+
# when a new template-based repository has been created.
4+
5+
name: Template Cleanup
6+
on:
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
13+
# Run cleaning process only if workflow is triggered by the non-JetBrains/intellij-platform-plugin-template repository.
14+
template-cleanup:
15+
name: Template Cleanup
16+
runs-on: ubuntu-latest
17+
if: github.event.repository.name != 'php-pkg-template'
18+
steps:
19+
20+
# Check out current repository
21+
- name: Fetch Sources
22+
uses: actions/[email protected]
23+
24+
# Cleanup project
25+
- name: Cleanup
26+
run: |
27+
export LC_CTYPE=C
28+
export LANG=C
29+
# Prepare variables
30+
NAME="${GITHUB_REPOSITORY##*/}"
31+
ACTOR=$(echo $GITHUB_ACTOR | tr '[:upper:]' '[:lower:]')
32+
SAFE_NAME=$(echo $NAME | sed 's/[^a-zA-Z0-9]//g' | tr '[:upper:]' '[:lower:]')
33+
SAFE_ACTOR=$(echo $ACTOR | sed 's/[^a-zA-Z0-9]//g' | tr '[:upper:]' '[:lower:]')
34+
GROUP="com.github.$SAFE_ACTOR.$SAFE_NAME"
35+
# Replace placeholders in the template-cleanup files
36+
sed -i "s/%NAME%/$NAME/g" .github/template-cleanup/*
37+
sed -i "s/%REPOSITORY%/${GITHUB_REPOSITORY/\//\\/}/g" .github/template-cleanup/*
38+
sed -i "s/%GROUP%/$GROUP/g" .github/template-cleanup/*
39+
# Replace template package name in project files with $GROUP
40+
find src -type f -exec sed -i "s/org.jetbrains.plugins.template/$GROUP/g" {} +
41+
find src -type f -exec sed -i "s/Template/$NAME/g" {} +
42+
find src -type f -exec sed -i "s/JetBrains/$ACTOR/g" {} +
43+
# Move content
44+
mkdir -p src/main/kotlin/${GROUP//.//}
45+
mkdir -p src/test/kotlin/${GROUP//.//}
46+
cp -R .github/template-cleanup/* .
47+
cp -R src/main/kotlin/org/jetbrains/plugins/template/* src/main/kotlin/${GROUP//.//}/
48+
cp -R src/test/kotlin/org/jetbrains/plugins/template/* src/test/kotlin/${GROUP//.//}/
49+
# Cleanup
50+
rm -rf \
51+
.github/ISSUE_TEMPLATE \
52+
.github/readme \
53+
.github/template-cleanup \
54+
.github/workflows/template-cleanup.yml \
55+
.idea/icon.png \
56+
src/main/kotlin/org \
57+
src/test/kotlin/org \
58+
CODE_OF_CONDUCT.md \
59+
LICENSE
60+
# Commit modified files
61+
- name: Commit files
62+
run: |
63+
git config --local user.email "[email protected]"
64+
git config --local user.name "GitHub Action"
65+
git add .
66+
git commit -m "Template cleanup"
67+
# Push changes
68+
- name: Push changes
69+
uses: ad-m/github-push-action@master
70+
with:
71+
branch: main
72+
github_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)