diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..6efd6d24 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,60 @@ +name: 'Test' +on: ['push'] + +jobs: + + build: + runs-on: 'ubuntu-latest' + + steps: + - uses: 'actions/checkout@v1' + + - name: 'Docker Build' + run: 'docker build .' + + deployment: + runs-on: 'ubuntu-latest' + steps: + - name: 'Checkout' + uses: 'actions/checkout@v1' + + - name: 'Deploy Canary' + uses: 'deliverybot/helm@ci-v2' + with: + helm: helm3 + token: '${{ github.token }}' + secrets: '${{ toJSON(secrets) }}' + chart: 'app' + namespace: production + release: production-myapp + version: '${{ github.sha }}' + track: canary + value-files: '["./tests/values.yml"]' + values: | + replicaCount: 1 + image: + repository: nginx + tag: latest + env: + KUBECONFIG_FILE: '${{ secrets.KUBECONFIG }}' + + - name: 'Deploy Production' + uses: 'deliverybot/helm@ci-v2' + with: + helm: helm3 + token: '${{ github.token }}' + secrets: '${{ toJSON(secrets) }}' + chart: 'app' + namespace: production + release: production-myapp + version: '${{ github.sha }}' + track: stable + value-files: '["./tests/values.yml"]' + remove-canary: "true" + values: | + replicaCount: 5 + image: + repository: nginx + tag: latest + env: + KUBECONFIG_FILE: '${{ secrets.KUBECONFIG }}' diff --git a/action.yml b/action.yml index e129872c..ff514c0b 100644 --- a/action.yml +++ b/action.yml @@ -28,4 +28,4 @@ inputs: JSON encoded map. runs: using: docker - image: docker://gcr.io/deliverybot/helm:v1.0.0 + image: Dockerfile diff --git a/cloudbuild.yaml b/cloudbuild.yaml deleted file mode 100644 index 2bb43019..00000000 --- a/cloudbuild.yaml +++ /dev/null @@ -1,14 +0,0 @@ -steps: -- name: 'colinjfw/ci:latest' - entrypoint: /workspace/hack/get-tag.sh - env: - - BRANCH_NAME=$BRANCH_NAME - - COMMIT_SHA=$COMMIT_SHA - -- name: gcr.io/cloud-builders/docker - entrypoint: sh - args: ['-c', 'docker build -t gcr.io/deliverybot/helm:$(cat _TAG) .'] - -- name: gcr.io/cloud-builders/docker - entrypoint: sh - args: ['-c', 'docker push gcr.io/deliverybot/helm:$(cat _TAG)'] diff --git a/hack/get-tag.sh b/hack/get-tag.sh deleted file mode 100755 index 417fa421..00000000 --- a/hack/get-tag.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -latest_release_sha=$(curl https://api.github.com/repos/deliverybot/helm/tags | jq -r '.[0].commit.sha') -latest_release_version=$(curl https://api.github.com/repos/deliverybot/helm/tags | jq -r '.[0].name') -echo $latest_release_sha -echo $latest_release_version -if [[ $latest_release_sha == $COMMIT_SHA ]]; then - echo $latest_release_version > /workspace/_TAG -else - echo $BRANCH_NAME > /workspace/_TAG -fi - -cat _TAG diff --git a/hack/update-version.sh b/hack/update-version.sh deleted file mode 100755 index dc65cbfe..00000000 --- a/hack/update-version.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -export version=$(cat package.json | jq -r '.version') -yq --yaml-output '.runs.image = "gcr.io/deliverybot/helm:v'${version}'"' < action.yml > action.yml.b && mv action.yml.b action.yml -git add . diff --git a/package.json b/package.json index 21199eb3..ca45cb42 100644 --- a/package.json +++ b/package.json @@ -15,11 +15,6 @@ "mustache": "^3.0.3" }, "scripts": { - "release": "standard-version --commit-all" - }, - "standard-version": { - "scripts": { - "postbump": "./hack/update-version.sh" - } + "release": "standard-version" } } diff --git a/tests/values.yml b/tests/values.yml new file mode 100644 index 00000000..aa1d51bf --- /dev/null +++ b/tests/values.yml @@ -0,0 +1,7 @@ +env: +- name: ENVIRONMENT + value: production + +secrets: +- name: API_KEY + value: '${{ secrets.API_KEY }}'