|
9 | 9 | build:
|
10 | 10 | name: Build
|
11 | 11 | runs-on: ubuntu-latest
|
12 |
| - defaults: |
13 |
| - run: |
14 |
| - shell: bash |
15 | 12 | steps:
|
16 | 13 | - name: Check out code into the Go module directory
|
17 | 14 | uses: actions/checkout@v1
|
18 | 15 |
|
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 |
| -
|
35 | 16 | - name: Install GitHub CLI
|
36 | 17 | run: |
|
37 | 18 | curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
|
38 | 19 | sudo mv bin/hub /usr/local/bin
|
39 | 20 |
|
| 21 | + - name: Install Helm 3 |
| 22 | + run: | |
| 23 | + curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash |
| 24 | +
|
40 | 25 | - name: Clone charts repository
|
41 | 26 | env:
|
| 27 | + GITHUB_USER: 1gtm |
42 | 28 | GITHUB_TOKEN: ${{ secrets.LGTM_GITHUB_TOKEN }}
|
| 29 | + CHART_REPOSITORY: ${{ secrets.CHART_REPOSITORY }} |
43 | 30 | 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" |
49 | 37 |
|
50 | 38 | - 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 |
63 | 39 | env:
|
| 40 | + GITHUB_USER: 1gtm |
64 | 41 | GITHUB_TOKEN: ${{ secrets.LGTM_GITHUB_TOKEN }}
|
| 42 | + CHART_REPOSITORY: ${{ secrets.CHART_REPOSITORY }} |
65 | 43 | 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