-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #369 from LeaYeh/ci-action-inputs
- Loading branch information
Showing
8 changed files
with
125 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,14 +7,39 @@ on: | |
- 'v*' | ||
|
||
jobs: | ||
update_evaluation_branch: | ||
check_tag_version: | ||
name: Check Tag Version | ||
runs-on: ubuntu-latest | ||
env: | ||
proceed: | ||
main_tag: | ||
outputs: | ||
main_tag: ${{ steps.check_new_version.outputs.main_tag }} | ||
is_new_version: ${{ steps.check_new_version.outputs.is_new_version }} | ||
steps: | ||
- name: Checkout tag | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Check if new version | ||
id: check_new_version | ||
run: | | ||
main_tag=$(git tag --sort=-creatordate --merged origin/main 2>/dev/null | head -n 1) || true | ||
eval_tag=$(git tag --sort=-creatordate --no-merged origin/main 2>/dev/null | head -n 1) || true | ||
echo "MAIN_TAG: $main_tag" | ||
echo "EVAL_TAG: $eval_tag" | ||
echo "main_tag=$main_tag" >> $GITHUB_OUTPUT | ||
if [[ "$main_tag" > "$eval_tag" ]]; then | ||
echo "is_new_version=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "is_new_version=false" >> $GITHUB_OUTPUT | ||
fi | ||
update_evaluation_branch: | ||
name: Update Evaluation Branch | ||
needs: check_tag_version | ||
if: needs.check_tag_version.outputs.is_new_version == 'true' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
- name: Checkout tag | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
@@ -24,63 +49,41 @@ jobs: | |
git config --local user.email "[email protected]" | ||
git config --local user.name "Lea Yeh" | ||
- name: Check tag version | ||
run: | | ||
MAIN_TAG=$(git tag --sort=-creatordate --merged origin/main 2>/dev/null | head -n 1) || true | ||
EVAL_TAG=$(git tag --sort=-creatordate --no-merged origin/main 2>/dev/null | head -n 1) || true | ||
echo "MAIN_TAG: $MAIN_TAG" | ||
echo "EVAL_TAG: $EVAL_TAG" | ||
echo main_tag=$MAIN_TAG >> "$GITHUB_ENV" | ||
if [[ "$MAIN_TAG" > "$EVAL_TAG" ]]; then | ||
echo "proceed=true" >> "$GITHUB_ENV" | ||
else | ||
echo "proceed=false" >> "$GITHUB_ENV" | ||
fi | ||
- name: Save .github directory | ||
if: env.proceed == 'true' | ||
run: | | ||
cp -rf .github ~/.github | ||
- name: Setup evaluation branch | ||
if: env.proceed == 'true' | ||
run: | | ||
git checkout -b evaluation origin/evaluation || git checkout -b evaluation | ||
git merge origin/main || (git checkout --theirs . && git add -A) | ||
- name: Restore .github directory | ||
if: env.proceed == 'true' | ||
run: | | ||
rm -rf .github | ||
mv ~/.github .github | ||
- name: Partial cleanup of forbidden files | ||
if: env.proceed == 'true' | ||
uses: ./.github/actions/cleanup_partial | ||
|
||
- name: Commit partial cleanup to evaluation branch | ||
if: env.proceed == 'true' | ||
run: | | ||
git add -A | ||
git commit -m "[GH-BOT] Remove forbidden files and empty folders" | ||
- name: 📏 Check norminette | ||
if: env.proceed == 'true' | ||
uses: ./.github/actions/norminette | ||
|
||
- name: Full cleanup of forbidden files | ||
if: env.proceed == 'true' | ||
uses: ./.github/actions/cleanup_full | ||
|
||
- name: Amend full cleanup to evaluation branch | ||
if: env.proceed == 'true' | ||
run: | | ||
git add -A | ||
git commit --amend --no-edit | ||
- name: 🏷️ Set version tag on evaluation branch | ||
if: env.proceed == 'true' | ||
run: | | ||
EVAL_TAG="${{ env.main_tag }}-eval" | ||
git tag "$EVAL_TAG" | ||
git push origin evaluation "$EVAL_TAG" | ||
eval_tag="${{ needs.check_tag_version.outputs.main_tag }}-eval" | ||
git tag "$eval_tag" | ||
git push origin evaluation "$eval_tag" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters