Create SelfHosted Helm Package #93
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Create SelfHosted Helm Package" | |
on: | |
release: | |
types: [prereleased, released] | |
env: | |
GCLOUD_VERSION: '297.0.1' # https://github.com/google-github-actions/setup-gcloud/issues/128 | |
CHARTS_REPOSITORY: "https://helm.carto.com/" | |
CHARTS_BUCKET: "gs://carto-helm" | |
PROJECT_ID: carto-onprem-artifacts | |
ARTIFACTS_PROJECT_ID: "carto-artifacts" | |
jobs: | |
helm-package: | |
timeout-minutes: 3 | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Google Cloud Auth | |
uses: google-github-actions/auth@v0 | |
with: | |
credentials_json: ${{ secrets.CARTO_ARTIFACTS_SERVICE_ACCOUNT }} | |
project_id: ${{ env.ARTIFACTS_PROJECT_ID }} | |
- name: Google Cloud install | |
uses: google-github-actions/setup-gcloud@v0 | |
with: | |
project_id: ${{ env.PROJECT_ID }} | |
version: ${{ env.GCLOUD_VERSION }} | |
- name: Install helm | |
shell: bash | |
run: | | |
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash | |
- name: Set up yq | |
uses: frenck/action-setup-yq@v1 | |
- name: Edit package | |
if: github.event.action == 'prereleased' | |
shell: bash | |
run: | | |
yq -i '.version = .version + "-beta"' chart/Chart.yaml | |
- name: Create package | |
shell: bash | |
run: | | |
helm repo add bitnami https://charts.bitnami.com/bitnami | |
helm dependency build chart | |
helm package chart | |
gsutil cp -r "${CHARTS_BUCKET}" . | |
mkdir packages-selfhosted-charts | |
mv carto-helm/*.tgz packages-selfhosted-charts/ | |
mv carto-${{ github.event.release.tag_name }}*.tgz packages-selfhosted-charts/ | |
helm repo index packages-selfhosted-charts --url "${CHARTS_REPOSITORY}" | |
- name: Upload chart | |
shell: bash | |
run: | | |
gsutil -h "Cache-Control:public,max-age=3600,s-maxage=3600" -m rsync -x "^index.yaml$" -d packages-selfhosted-charts/ "${CHARTS_BUCKET}" | |
gsutil -h "Cache-Control:public,max-age=180,s-maxage=30" cp packages-selfhosted-charts/index.yaml "${CHARTS_BUCKET}" | |
- name: Slack notification | |
if: github.event.action == 'released' | |
env: | |
SLACK_CHANNEL: C02PADFM0E4 # #carto-selfhosted | |
JOB_STATUS: ${{ job.status }} | |
run: | | |
if [ 'success' == "${JOB_STATUS}" ];then | |
status_emoji=:rocket: | |
else | |
status_emoji=:x: | |
fi | |
curl -F "text=${status_emoji} Self Hosted Helm Chart Release \`${{ github.event.release.tag_name }}\` published: | |
- *<https://github.com/CartoDB/carto-selfhosted-helm/releases|Releases>*" \ | |
-F "channel=${SLACK_CHANNEL}" \ | |
-H "Authorization: Bearer ${{ secrets.SLACK_KEY }}" \ | |
-X POST https://slack.com/api/chat.postMessage |