Skip to content

Commit f663964

Browse files
Refactor Github Action per b/485167538
1 parent ddbda16 commit f663964

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

.github/workflows/draft-release.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ jobs:
3535
if: steps.regex-match.outputs.group1 != ''
3636
run: |
3737
echo "::set-output name=applicable::true"
38-
echo "This is a release commit: ${{ steps.regex-match.outputs.group1 }}"
38+
echo "This is a release commit: ${STEPS_REGEX_MATCH_OUTPUTS_GROUP1}"
39+
env:
40+
STEPS_REGEX_MATCH_OUTPUTS_GROUP1: ${{ steps.regex-match.outputs.group1 }}
3941
outputs:
4042
applicable: ${{ steps.check-commit-message.outputs.applicable }}
4143
version: ${{ steps.regex-match.outputs.group1 }}
@@ -55,15 +57,17 @@ jobs:
5557

5658
- name: Calculate Tag and Release names
5759
run: |
58-
echo TAG_NAME="v${{ needs.check.outputs.version }}" >> $GITHUB_ENV
59-
echo RELEASE_NAME="v${{ needs.check.outputs.version }} Release" >> $GITHUB_ENV
60+
echo TAG_NAME="v${NEEDS_CHECK_OUTPUTS_VERSION}" >> $GITHUB_ENV
61+
echo RELEASE_NAME="v${NEEDS_CHECK_OUTPUTS_VERSION} Release" >> $GITHUB_ENV
62+
env:
63+
NEEDS_CHECK_OUTPUTS_VERSION: ${{ needs.check.outputs.version }}
6064

6165
- name: Create and push Tag
6266
run: |
6367
git config --local user.email "action@github.com"
6468
git config --local user.name "GitHub Action"
65-
git tag -a ${{ env.TAG_NAME }} -m "${{ env.RELEASE_NAME }}"
66-
git push origin ${{ env.TAG_NAME }}
69+
git tag -a ${TAG_NAME} -m "${RELEASE_NAME}"
70+
git push origin ${TAG_NAME}
6771
6872
- name: Install gsutil
6973
run: |
@@ -79,20 +83,20 @@ jobs:
7983
while [ $found -lt 10 -a $retries -gt 0 ]
8084
do
8185
sleep 3m
82-
found=$(gsutil du gs://skaffold/releases/${{ env.TAG_NAME }}/ | wc -l)
86+
found=$(gsutil du gs://skaffold/releases/${TAG_NAME}/ | wc -l)
8387
retries=$((retries-1))
8488
done
85-
gsutil -m cp -r gs://skaffold/releases/${{ env.TAG_NAME }}/ $HOME
89+
gsutil -m cp -r gs://skaffold/releases/${TAG_NAME}/ $HOME
8690
8791
- name: Create Release
8892
shell: bash
8993
run: |
9094
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
9195
body=$(git log -p --follow -1 CHANGELOG.md | grep '^\+' | cut -c 2- | tail -n +2)
9296
assets=()
93-
for asset in $HOME/${{ env.TAG_NAME }}/*; do
97+
for asset in $HOME/${TAG_NAME}/*; do
9498
assets+=("-a" "$asset")
9599
done
96-
bin/hub release create "${assets[@]}" -m "${{ env.RELEASE_NAME }}" -m "$body" --draft ${{ env.TAG_NAME }}
100+
bin/hub release create "${assets[@]}" -m "${RELEASE_NAME}" -m "$body" --draft ${TAG_NAME}
97101
env:
98102
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/performance-comparison.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ jobs:
9898
- name: Make and install Skaffold binary from current PR
9999
run: |
100100
make
101-
sudo install "${HOME}/work/skaffold/skaffold/out/skaffold" /usr/local/bin/skaffold-${{ steps.comment-branch.outputs.head_ref }}
101+
sudo install "${HOME}/work/skaffold/skaffold/out/skaffold" /usr/local/bin/skaffold-${STEPS_COMMENT_BRANCH_OUTPUTS_HEAD_REF}
102+
env:
103+
STEPS_COMMENT_BRANCH_OUTPUTS_HEAD_REF: ${{ steps.comment-branch.outputs.head_ref }}
102104

103105
- name: Install Skaffold from main branch (built from CI/CD on merge)
104106
run: |
@@ -107,18 +109,22 @@ jobs:
107109
108110
- name: Parse Comment To Yaml Format
109111
run: |
110-
tail -n +2 <<< '${{ github.event.comment.body }}' > yaml-input-file.yaml
112+
tail -n +2 <<< '${GITHUB_EVENT_COMMENT_BODY}' > yaml-input-file.yaml
113+
env:
114+
GITHUB_EVENT_COMMENT_BODY: ${{ github.event.comment.body }}
111115

112116
- name: Run performance comparison benchmarks
113117
id: run-performance-comparison-benchmarks
114118
run: |
115-
/usr/local/bin/skaffold-${{ steps.comment-branch.outputs.head_ref }} config set --global collect-metrics false
116-
make COMPARISONSTATS_ARGS='--summary-output-path=gh-comment.txt --yaml-input-file=yaml-input-file.yaml --warmup-runs=1 /usr/local/bin/skaffold-from-main-branch /usr/local/bin/skaffold-${{ steps.comment-branch.outputs.head_ref }} helm-deployment main.go "//per-dev-iteration-comment"' comparisonstats
119+
/usr/local/bin/skaffold-${STEPS_COMMENT_BRANCH_OUTPUTS_HEAD_REF} config set --global collect-metrics false
120+
make COMPARISONSTATS_ARGS='--summary-output-path=gh-comment.txt --yaml-input-file=yaml-input-file.yaml --warmup-runs=1 /usr/local/bin/skaffold-from-main-branch /usr/local/bin/skaffold-${STEPS_COMMENT_BRANCH_OUTPUTS_HEAD_REF} helm-deployment main.go "//per-dev-iteration-comment"' comparisonstats
117121
body=$(cat gh-comment.txt)
118122
body="${body//'%'/'%25'}"
119123
body="${body//$'\n'/'%0A'}"
120124
body="${body//$'\r'/'%0D'}"
121125
echo ::set-output name=body::$body
126+
env:
127+
STEPS_COMMENT_BRANCH_OUTPUTS_HEAD_REF: ${{ steps.comment-branch.outputs.head_ref }}
122128

123129
- name: Create comment
124130
uses: peter-evans/create-or-update-comment@c9fcb64660bc90ec1cc535646af190c992007c32

0 commit comments

Comments
 (0)