|
| 1 | +name: Portal Chart Deployment |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [created, edited] |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +defaults: |
| 9 | + run: |
| 10 | + shell: bash |
| 11 | + |
| 12 | +env: |
| 13 | + SERVICE_NAME: cava-realtime-client |
| 14 | + CHART_PATH: ./resources/helm/cava-realtime-client |
| 15 | + TEST_CHART_VALUE: .ci-helpers/secrets/dev-test.yaml |
| 16 | + |
| 17 | +jobs: |
| 18 | + publish: |
| 19 | + runs-on: ubuntu-20.04 |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v2 |
| 22 | + with: |
| 23 | + # chartpress requires the full history |
| 24 | + fetch-depth: 0 |
| 25 | + - name: Set up Python 3.8 |
| 26 | + uses: actions/setup-python@v2 |
| 27 | + with: |
| 28 | + python-version: 3.8 |
| 29 | + - name: Install helm |
| 30 | + run: | |
| 31 | + curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get-helm-3 | bash |
| 32 | + - name: Install git-crypt |
| 33 | + run: sudo apt-get install git-crypt |
| 34 | + - name: Install Chartpress |
| 35 | + run: | |
| 36 | + # Six doesn't get pulled in for some reason ... |
| 37 | + pip install six chartpress |
| 38 | + chartpress --help |
| 39 | + - name: Configure AWS Credentials |
| 40 | + uses: aws-actions/configure-aws-credentials@v1 |
| 41 | + with: |
| 42 | + aws-access-key-id: ${{ secrets.AWS_KEY }} |
| 43 | + aws-secret-access-key: ${{ secrets.AWS_SECRET }} |
| 44 | + aws-region: us-west-2 |
| 45 | + - name: Setup credentials |
| 46 | + run: | |
| 47 | + aws s3 cp ${{ secrets.GIT_CRYPT_KEY }} ./crypt.key |
| 48 | + aws s3 cp ${{ secrets.HELM_DEPLOY_KEY }} ${PWD}/deploy_key |
| 49 | + chmod 400 ${PWD}/deploy_key |
| 50 | + GIT_SSH_COMMAND="ssh -i ${PWD}/deploy_key" |
| 51 | + echo "GIT_SSH_COMMAND=${GIT_SSH_COMMAND}" >> $GITHUB_ENV |
| 52 | + - name: Unlock git-crypt Secrets |
| 53 | + run: git-crypt unlock ./crypt.key && git-crypt status |
| 54 | + - name: Update chart dependencies |
| 55 | + run: | |
| 56 | + helm dependencies update ${{ env.CHART_PATH }} |
| 57 | + - name: Lint chart's templates |
| 58 | + run: | |
| 59 | + helm lint ${{ env.CHART_PATH }} --values ${{ env.TEST_CHART_VALUE }} |
| 60 | +
|
| 61 | + - name: Validate chart's templates can render |
| 62 | + run: | |
| 63 | + helm template ${{ env.CHART_PATH }} --values ${{ env.TEST_CHART_VALUE }} 1>/dev/null |
| 64 | + - name: Configure a git user |
| 65 | + # Having a user.email and user.name configured with git is required to |
| 66 | + # make commits, which is something chartpress does when publishing. |
| 67 | + # While Travis CI had a dummy user by default, GitHub Actions doesn't |
| 68 | + # and require this explicitly setup. |
| 69 | + run: | |
| 70 | + git config --global user.email "[email protected]" |
| 71 | + git config --global user.name "GitHub Actions user" |
| 72 | + - name: Login to DockerHub |
| 73 | + uses: docker/login-action@v1 |
| 74 | + with: |
| 75 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 76 | + password: ${{ secrets.DOCKER_TOKEN }} |
| 77 | + - name: Publish images and chart with chartpress |
| 78 | + env: |
| 79 | + GITHUB_REPOSITORY: "${{ github.repository }}" |
| 80 | + working-directory: ./resources/helm |
| 81 | + run: | |
| 82 | + ../../.ci-helpers/publish |
0 commit comments