Skip to content

Commit 9740a56

Browse files
authored
Update release.yml
Signed-off-by: Tamal Saha <tamal@appscode.com>
1 parent 290be5b commit 9740a56

File tree

1 file changed

+16
-59
lines changed

1 file changed

+16
-59
lines changed

.github/workflows/release.yml

Lines changed: 16 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -9,80 +9,37 @@ jobs:
99
build:
1010
name: Build
1111
runs-on: ubuntu-latest
12-
defaults:
13-
run:
14-
shell: bash
1512
steps:
1613
- name: Check out code into the Go module directory
1714
uses: actions/checkout@v1
1815

19-
- name: Parse Parameters
20-
id: params
21-
run: |
22-
GIT_TAG=${GITHUB_REF#'refs/tags/'}
23-
echo ::set-output name=git_tag::$GIT_TAG
24-
while IFS=$': \t' read -r marker v; do
25-
case $marker in
26-
Release)
27-
echo ::set-output name=release::$v
28-
;;
29-
Release-tracker)
30-
echo ::set-output name=release_tracker::$v
31-
;;
32-
esac
33-
done < <(git tag -l --format='%(body)' $GIT_TAG)
34-
3516
- name: Install GitHub CLI
3617
run: |
3718
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
3819
sudo mv bin/hub /usr/local/bin
3920
21+
- name: Install Helm 3
22+
run: |
23+
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
24+
4025
- name: Clone charts repository
4126
env:
27+
GITHUB_USER: 1gtm
4228
GITHUB_TOKEN: ${{ secrets.LGTM_GITHUB_TOKEN }}
29+
CHART_REPOSITORY: ${{ secrets.CHART_REPOSITORY }}
4330
run: |
44-
cd $HOME
45-
git clone https://1gtm:${GITHUB_TOKEN}@github.com/appscode/charts.git
46-
cd charts
47-
git config user.name "1gtm"
48-
git config user.email "1gtm@appscode.com"
31+
url="https://${GITHUB_USER}:${GITHUB_TOKEN}@${CHART_REPOSITORY}.git"
32+
cd $RUNNER_WORKSPACE
33+
git clone $url
34+
cd $(basename $CHART_REPOSITORY)
35+
git config user.name "${GITHUB_USER}"
36+
git config user.email "${GITHUB_USER}@appscode.com"
4937
5038
- name: Package
51-
run: |
52-
echo "install helm 3"
53-
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
54-
echo "package charts"
55-
find charts -maxdepth 1 -mindepth 1 -type d -exec helm package {} -d {} \;
56-
helm repo index --merge $HOME/charts/stable/index.yaml --url https://charts.appscode.com/stable/ charts
57-
mv charts/index.yaml $HOME/charts/stable/index.yaml
58-
cd charts
59-
find . -maxdepth 1 -mindepth 1 -type d -exec mkdir -p $HOME/charts/stable/{} \;
60-
find . -path ./charts -prune -o -name '*.tgz' -exec mv {} $HOME/charts/stable/{} \;
61-
62-
- name: Create pull request
6339
env:
40+
GITHUB_USER: 1gtm
6441
GITHUB_TOKEN: ${{ secrets.LGTM_GITHUB_TOKEN }}
42+
CHART_REPOSITORY: ${{ secrets.CHART_REPOSITORY }}
6543
run: |
66-
pr_branch=${GITHUB_REPOSITORY}/${GITHUB_RUN_ID}
67-
cd $HOME/charts
68-
git checkout -b $pr_branch
69-
git add --all
70-
ct_cmd="git commit -a -s -m \"Publish $GITHUB_REPOSITORY@${{ steps.params.outputs.git_tag }} charts\""
71-
pr_cmd=$(cat <<EOF
72-
hub pull-request \
73-
--labels automerge \
74-
--message "Publish $GITHUB_REPOSITORY@${{ steps.params.outputs.git_tag }} charts"
75-
EOF
76-
)
77-
if [ ! -z ${{ steps.params.outputs.release }} ]; then
78-
ct_cmd="$ct_cmd --message \"Release: ${{ steps.params.outputs.release }}\""
79-
pr_cmd="$pr_cmd --message \"Release: ${{ steps.params.outputs.release }}\""
80-
fi
81-
if [ ! -z ${{ steps.params.outputs.release_tracker }} ]; then
82-
ct_cmd="$ct_cmd --message \"Release-tracker: ${{ steps.params.outputs.release_tracker }}\""
83-
pr_cmd="$pr_cmd --message \"Release-tracker: ${{ steps.params.outputs.release_tracker }}\""
84-
fi
85-
pr_cmd="$pr_cmd --message \"Signed-off-by: $(git config --get user.name) <$(git config --get user.email)>\""
86-
eval "$ct_cmd"
87-
git push -u origin HEAD -f
88-
eval "$pr_cmd"
44+
cd $RUNNER_WORKSPACE/$(basename $CHART_REPOSITORY)
45+
./hack/scripts/open-pr.sh $GITHUB_WORKSPACE

0 commit comments

Comments
 (0)