diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index bb3157e..0000000 --- a/.drone.yml +++ /dev/null @@ -1,60 +0,0 @@ -kind: pipeline -type: docker -name: charts-ci - -steps: - -- name: validate_chart - image: alpine/helm:3.2.4 - commands: - - ./ci/test.sh - when: - branch: master - event: [push, tag, pull_request] - -- name: fetch_git_tags - image: alpine/git - commands: - - git fetch --tags - when: - branch: master - event: push - -- name: build_latest_chart - image: alpine/helm:3.2.4 - commands: - - apk add -U git - - export VERSION=$(git describe --tags $(git rev-list --tags --max-count=1))-$(git rev-parse --short HEAD) - - ./ci/build.sh $VERSION unstable - when: - branch: master - event: push - -- name: build_release_chart - image: alpine/helm:3.2.4 - commands: - - ./ci/build.sh ${DRONE_TAG} - when: - branch: master - event: tag - -- name: upload - image: plugins/s3 - settings: - endpoint: - from_secret: s3_endpoint - region: - from_secret: s3_region - bucket: - from_secret: s3_bucket - access_key: - from_secret: s3_access_key - secret_key: - from_secret: s3_secret_key - source: output/**/* - strip_prefix: output/ - target: / - acl: public-read - when: - branch: master - event: [push, tag] diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..8b4f971 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,33 @@ +name: build + +on: + push: + branches: + - master + +jobs: + build-chart: + runs-on: ubuntu-latest + if: github.repository == 'aerokube/charts' + steps: + - uses: actions/checkout@v2 + + - name: Test + run: ci/test.sh + + - name: Build + run: | + git fetch --tags + export VERSION=$(git describe --tags $(git rev-list --tags --max-count=1))-$(git rev-parse --short HEAD) + ci/build.sh $VERSION unstable + + - name: Configure S3 credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.S3_ACCESS_KEY }} + aws-secret-access-key: ${{ secrets.S3_SECRET_KEY }} + aws-region: ${{ secrets.S3_REGION }} + + - name: Send output to S3 bucket + working-directory: ./output + run: aws s3 cp . --endpoint=${{ secrets.S3_ENDPOINT }} s3://${{ secrets.S3_BUCKET_NAME }} --recursive --acl public-read \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..3c01cc7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,32 @@ +name: release + +on: + release: + types: [published] + +jobs: + release-chart: + runs-on: ubuntu-latest + if: github.repository == 'aerokube/charts' + steps: + - uses: actions/checkout@v2 + + - name: Test + run: ci/test.sh + + - name: Prepare release version + run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV + + - name: Build + run: ci/build.sh $RELEASE_VERSION + + - name: Configure S3 credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.S3_ACCESS_KEY }} + aws-secret-access-key: ${{ secrets.S3_SECRET_KEY }} + aws-region: ${{ secrets.S3_REGION }} + + - name: Send output to S3 bucket + working-directory: ./output + run: aws s3 cp . --endpoint=${{ secrets.S3_ENDPOINT }} s3://${{ secrets.S3_BUCKET_NAME }} --recursive --acl public-read \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..f9db5e5 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,13 @@ +name: test + +on: + pull_request: + +jobs: + test-chart: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Test + run: ci/test.sh \ No newline at end of file diff --git a/ci/build.sh b/ci/build.sh index e6b676a..49475fd 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -1,5 +1,7 @@ #!/bin/sh +set -e + CHARTS_REPO="https://charts.aerokube.com/" version=$1 @@ -9,8 +11,8 @@ if [ -n "$path" ]; then output_dir="$output_dir/$path" CHARTS_REPO="$CHARTS_REPO$path/" fi -mkdir -p ${output_dir} -helm package moon --destination ${output_dir} --version ${version} -cd ${output_dir} -wget ${CHARTS_REPO}/index.yaml || true -helm repo index . --url ${CHARTS_REPO} --merge index.yaml +mkdir -p "$output_dir" +helm package moon --destination "$output_dir" --version "$version" +cd "$output_dir" +wget "$CHARTS_REPO/index.yaml" || true +helm repo index . --url "$CHARTS_REPO" --merge index.yaml