Skip to content

Commit 4163a9c

Browse files
authored
[cherry-pick] Update release.yml (#27)
/cherry-pick Signed-off-by: Tamal Saha <tamal@appscode.com>
1 parent 66d54d2 commit 4163a9c

File tree

2 files changed

+15
-82
lines changed

2 files changed

+15
-82
lines changed

.github/workflows/release.yml

Lines changed: 14 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -9,104 +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
40-
- name: Print version info
41-
id: semver
21+
- name: Install Helm 3
4222
run: |
43-
make version
44-
45-
- name: Set up Docker Buildx
46-
id: buildx
47-
uses: crazy-max/ghaction-docker-buildx@v1
48-
with:
49-
buildx-version: latest
50-
qemu-version: latest
51-
52-
- name: Available platforms
53-
run: echo ${{ steps.buildx.outputs.platforms }}
54-
55-
- name: Build
56-
env:
57-
DOCKER_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
58-
USERNAME: 1gtm
59-
APPSCODE_ENV: prod
60-
run: |
61-
docker login --username ${USERNAME} --password ${DOCKER_TOKEN}
62-
make release
23+
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
6324
6425
- name: Clone charts repository
6526
env:
27+
GITHUB_USER: 1gtm
6628
GITHUB_TOKEN: ${{ secrets.LGTM_GITHUB_TOKEN }}
29+
CHART_REPOSITORY: ${{ secrets.CHART_REPOSITORY }}
6730
run: |
68-
cd $HOME
69-
git clone https://1gtm:${GITHUB_TOKEN}@github.com/appscode/charts.git
70-
cd charts
71-
git config user.name "1gtm"
72-
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"
7337
7438
- name: Package
75-
run: |
76-
echo "install helm 3"
77-
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
78-
echo "package charts"
79-
find charts -maxdepth 1 -mindepth 1 -type d -exec helm package {} -d {} \;
80-
helm repo index --merge $HOME/charts/stable/index.yaml --url https://charts.appscode.com/stable/ charts
81-
mv charts/index.yaml $HOME/charts/stable/index.yaml
82-
cd charts
83-
find . -maxdepth 1 -mindepth 1 -type d -exec mkdir -p $HOME/charts/stable/{} \;
84-
find . -path ./charts -prune -o -name '*.tgz' -exec mv {} $HOME/charts/stable/{} \;
85-
86-
- name: Create pull request
8739
env:
40+
GITHUB_USER: 1gtm
8841
GITHUB_TOKEN: ${{ secrets.LGTM_GITHUB_TOKEN }}
42+
CHART_REPOSITORY: ${{ secrets.CHART_REPOSITORY }}
8943
run: |
90-
pr_branch=${GITHUB_REPOSITORY}/${GITHUB_RUN_ID}
91-
cd $HOME/charts
92-
git checkout -b $pr_branch
93-
git add --all
94-
ct_cmd="git commit -a -s -m \"Publish $GITHUB_REPOSITORY@${{ steps.params.outputs.git_tag }} charts\""
95-
pr_cmd=$(cat <<EOF
96-
hub pull-request \
97-
--labels automerge \
98-
--message "Publish $GITHUB_REPOSITORY@${{ steps.params.outputs.git_tag }} charts"
99-
EOF
100-
)
101-
if [ ! -z ${{ steps.params.outputs.release }} ]; then
102-
ct_cmd="$ct_cmd --message \"Release: ${{ steps.params.outputs.release }}\""
103-
pr_cmd="$pr_cmd --message \"Release: ${{ steps.params.outputs.release }}\""
104-
fi
105-
if [ ! -z ${{ steps.params.outputs.release_tracker }} ]; then
106-
ct_cmd="$ct_cmd --message \"Release-tracker: ${{ steps.params.outputs.release_tracker }}\""
107-
pr_cmd="$pr_cmd --message \"Release-tracker: ${{ steps.params.outputs.release_tracker }}\""
108-
fi
109-
pr_cmd="$pr_cmd --message \"Signed-off-by: $(git config --get user.name) <$(git config --get user.email)>\""
110-
eval "$ct_cmd"
111-
git push -u origin HEAD -f
112-
eval "$pr_cmd"
44+
cd $RUNNER_WORKSPACE/$(basename $CHART_REPOSITORY)
45+
./hack/scripts/open-pr.sh $GITHUB_WORKSPACE

hack/scripts/cherry-pick.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
set -eou pipefail
1818

1919
should_cherry_pick() {
20-
while IFS=$': \t' read -r -u9 marker v; do
20+
while IFS=$': \r\t' read -r -u9 marker v; do
2121
if [ "$marker" = "/cherry-pick" ]; then
2222
return 0
2323
fi

0 commit comments

Comments
 (0)