adjust helm chart name #12
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: Docker build and deploy to argoCD | |
on: | |
push: | |
branches: | |
- demo1 | |
env: | |
PROJECTNAME: pixelaw-core | |
REGISTRY: ${{ secrets.DOCKERHUB_USERNAME}} | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
helmTest: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install Helm | |
run: | | |
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | |
chmod 700 get_helm.sh | |
./get_helm.sh | |
- name: Lint Helm Chart | |
run: | | |
helm lint --values ./chart/pixelaw-core/values.yaml ./chart/pixelaw-core | |
deploy: | |
needs: [helmTest] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Get latest release | |
id: get-latest-release | |
uses: actions/github-script@v3 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
const release = await github.repos.getLatestRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo | |
}); | |
return release.data.tag_name; | |
- name: Set ENV variable | |
run: echo "VERSION=${{ steps.get-latest-release.outputs.result }}" >> $GITHUB_ENV | |
- name: Install ArgoCD CLI if not exists | |
run: | | |
if ! command -v argocd &> /dev/null; then | |
curl -sSL -o /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64 | |
chmod +x /usr/local/bin/argocd | |
fi | |
- name: Deploy Application Dry Run | |
env: | |
ARGOCD_SERVER: ${{ secrets.ARGOCD_SERVER }} | |
ARGOCD_AUTH_TOKEN: ${{ secrets.ARGOCD_AUTH_TOKEN }} | |
run: | | |
argocd app create $PROJECTNAME-demo1 \ | |
--repo https://pixelaw.github.io/core/ \ | |
--path chart/ \ | |
--revision ${VERSION:1} \ | |
--helm-chart $PROJECTNAME \ | |
--dest-namespace $PROJECTNAME-demo1 \ | |
--dest-server https://kubernetes.default.svc \ | |
--helm-set-string dockerImage=$REGISTRY/$PROJECTNAME:${VERSION} \ | |
--upsert \ | |
--server $ARGOCD_SERVER \ | |
--auth-token $ARGOCD_AUTH_TOKEN | |
argocd app sync pixelaw-core | |
argocd app wait pixelaw-core |