From 54d7e73729d3d8094402da053874c3ae65a0907b Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Thu, 28 Jan 2021 18:38:56 -0500 Subject: [PATCH] feat: migrate from circle-ci to github-actions Signed-off-by: Josh Soref --- .circleci/config.yml | 33 ++++------------------- .github/workflows/build-chart.yml | 44 +++++++++++++++++++++++++++++++ scripts/publish.sh | 12 ++++----- 3 files changed, 55 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/build-chart.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index 6c3306ec..38b05424 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,40 +2,17 @@ version: 2.1 jobs: lint: docker: - - image: quay.io/helmpack/chart-testing:v3.3.1 + - image: quay.io/prometheus/busybox steps: - - checkout - - run: helm repo add stable https://charts.helm.sh/stable - - run: ct lint --config .circleci/chart-testing.yaml --lint-conf .circleci/lintconf.yaml - # Technically this only needs to be run on master, but it's good to have it run on every PR - # so that it is regularly tested. + - run: "true" publish: docker: - # We just need an image with `helm` on it. Handily we know of one already. - - image: quay.io/helmpack/chart-testing:v3.3.1 + - image: quay.io/prometheus/busybox steps: - # install the additional keys needed to push to GitHub. Alex Collins owns these keys. - - add_ssh_keys - - run: git config --global user.email "nobody@circleci.com" - - run: git config --global user.name "Circle CI Build" - - checkout - - run: helm repo add stable https://charts.helm.sh/stable - - run: helm repo add minio https://helm.min.io/ - - run: helm repo add dandydeveloper https://dandydeveloper.github.io/charts/ - # Only actually publish charts on master. - - run: | - set -x - if [ "$CIRCLE_BRANCH" = "master" ]; then - export GIT_PUSH=true - else - export GIT_PUSH=false - fi - sh ./scripts/publish.sh + - run: "true" workflows: version: 2 workflow: jobs: - lint - - publish: - requires: - - lint + - publish diff --git a/.github/workflows/build-chart.yml b/.github/workflows/build-chart.yml new file mode 100644 index 00000000..8b44c558 --- /dev/null +++ b/.github/workflows/build-chart.yml @@ -0,0 +1,44 @@ +name: Helm +on: + push: + pull_request: +jobs: + lint: + runs-on: ubuntu-latest + container: quay.io/helmpack/chart-testing:v3.3.1 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: "0" + - run: helm repo add stable https://charts.helm.sh/stable + - run: ct lint --config .circleci/chart-testing.yaml --lint-conf .circleci/lintconf.yaml + # Technically this only needs to be run on master, but it's good to have it run on every PR + # so that it is regularly tested. + publish: + needs: lint + runs-on: ubuntu-latest + # We just need an image with `helm` on it. Handily we know of one already. + container: quay.io/helmpack/chart-testing:v3.3.1 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: "0" + - uses: actions/checkout@v2 + with: + ref: gh-pages + path: output + # Only actually publish charts on master. + - name: Publish + run: | + set -x + git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" + git config --global user.name "$GITHUB_ACTOR" + helm repo add stable https://charts.helm.sh/stable + helm repo add minio https://helm.min.io/ + helm repo add dandydeveloper https://dandydeveloper.github.io/charts/ + if [ "${GITHUB_REF#refs/heads/}" = "master" ]; then + export GIT_PUSH=true + else + export GIT_PUSH=false + fi + sh ./scripts/publish.sh diff --git a/scripts/publish.sh b/scripts/publish.sh index 025ba5d9..b9758ddb 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -4,8 +4,6 @@ set -eux SRCROOT="$(cd "$(dirname "$0")/.." && pwd)" GIT_PUSH=${GIT_PUSH:-false} -rm -rf $SRCROOT/output && git clone -b gh-pages git@github.com:argoproj/argo-helm.git $SRCROOT/output - helm repo add argoproj https://argoproj.github.io/argo-helm for dir in $(find $SRCROOT/charts -mindepth 1 -maxdepth 1 -type d); @@ -31,12 +29,14 @@ do helm --debug package $dir done -cp $SRCROOT/*.tgz output/ -cd $SRCROOT/output && helm repo index . +cp $SRCROOT/*.tgz $SRCROOT/output/ +cd $SRCROOT/output +helm repo index . -cd $SRCROOT/output && git status +git status +git add . && git commit -m "Publish charts" if [ "$GIT_PUSH" == "true" ] then - cd $SRCROOT/output && git add . && git commit -m "Publish charts" && git push git@github.com:argoproj/argo-helm.git gh-pages + git push origin gh-pages fi