Skip to content

Commit e64a48a

Browse files
authoredMar 19, 2024··
Merge pull request #252 from LeaYeh/cd-evaluation
[CD] Use GITHUB_ENV instead of GITHUB_OUTPUT
2 parents 4da3aa5 + ab05336 commit e64a48a

File tree

1 file changed

+10
-23
lines changed

1 file changed

+10
-23
lines changed
 

‎.github/workflows/delivery.yaml

+10-23
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ on:
88
jobs:
99
cleanup_and_merge:
1010
runs-on: ubuntu-latest
11-
outputs:
12-
proceed: ${{ steps.check_version.outputs.proceed }}
13-
main_tag: ${{ steps.check_version.outputs.MAIN_TAG }}
1411

1512
steps:
1613
- name: Checkout code
@@ -24,37 +21,27 @@ jobs:
2421
git config --local user.name "Lea Yeh"
2522
2623
- name: Check tag version
27-
id: check_version
2824
run: |
29-
MAIN_TAG=""
30-
EVAL_TAG=""
3125
MAIN_TAG=$(git describe --tags `git rev-list --tags --max-count=1` 2>/dev/null) || true
3226
if [[ $(git tag --contains origin/evaluation | wc -l) -gt 0 ]]; then
3327
EVAL_TAG=$(git describe --tags `git rev-list --tags --remotes=origin/evaluation --max-count=1` 2>/dev/null) || true
3428
fi
35-
echo MAIN_TAG=$MAIN_TAG >> "$GITHUB_OUTPUT"
36-
echo EVAL_TAG=$EVAL_TAG >> "$GITHUB_OUTPUT"
3729
echo "MAIN_TAG: $MAIN_TAG"
3830
echo "EVAL_TAG: $EVAL_TAG"
39-
if [[ -z "$EVAL_TAG" && -n "$MAIN_TAG" ]] || [[ "$MAIN_TAG" > "$EVAL_TAG" ]]; then
40-
echo "set to true"
41-
echo "proceed=true" >> "$GITHUB_OUTPUT"
31+
echo main_tag=$MAIN_TAG >> "$GITHUB_ENV"
32+
if [[ "$MAIN_TAG" > "$EVAL_TAG" ]]; then
33+
echo "proceed=true" >> "$GITHUB_ENV"
4234
else
43-
echo "set to false"
44-
echo "proceed=false" >> "$GITHUB_OUTPUT"
35+
echo "proceed=false" >> "$GITHUB_ENV"
4536
fi
4637
47-
- name: Print output for debugging
48-
run: |
49-
echo ${{ steps.check_version.outputs.proceed }}
50-
5138
- name: Setup evaluation branch
52-
if: steps.check_version.outputs.proceed == 'true'
39+
if: env.proceed == 'true'
5340
run: |
5441
git checkout -b evaluation 2>/dev/null || git checkout evaluation
5542
5643
- name: Merge and delete forbidden files and commit
57-
if: steps.check_version.outputs.proceed == 'true'
44+
if: env.proceed == 'true'
5845
run: |
5946
git merge origin/main
6047
find . -type d -name .git -prune -o -type f ! -name '*.c' ! -name '*.h' ! -name '*.mk' ! -name 'Makefile' -exec rm -rf {} +
@@ -64,8 +51,8 @@ jobs:
6451
git commit -m "[GH-BOT] Remove forbidden files and empty folders"
6552
6653
- name: Set version tag on evaluation branch
67-
if: steps.check_version.outputs.proceed == 'true'
54+
if: env.proceed == 'true'
6855
run: |
69-
eval_tag="${{ steps.check_version.outputs.MAIN_TAG }}-eval"
70-
git tag "$eval_tag"
71-
git push origin evaluation "$eval_tag"
56+
EVAL_TAG="${{ env.main_tag }}-eval"
57+
git tag "$EVAL_TAG"
58+
git push origin evaluation "$EVAL_TAG"

0 commit comments

Comments
 (0)
Please sign in to comment.