chore: release 1.1.6 #29
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: Push on master branch | |
on: | |
push: | |
branches: | |
- master | |
env: | |
NODE_VERSION: "14" | |
DOCKER_IMAGE: "kuzzleio/kepler" | |
jobs: | |
lint: | |
name: Lint ${{ matrix.project }} | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: true | |
matrix: | |
project: ['kepler', 'kepler-companion'] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- uses: actions/setup-node@v1.4.4 | |
with: | |
node-version: "12" | |
- name: Run linter | |
run: npm ci --prefix ${{ matrix.project }} && npm run test:lint --prefix ${{ matrix.project }} | |
publish-kepler-companion: | |
name: Publish Kepler Companion on NPM.js | |
runs-on: ubuntu-20.04 | |
needs: [lint] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
registry-url: 'https://registry.npmjs.org' | |
- run: | | |
cd kepler-companion | |
npm ci | |
npm run build | |
npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
publish-kepler-image: | |
name: Build and publish Kepler Docker image on Dockerhub | |
runs-on: ubuntu-20.04 | |
needs: [lint] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Get current version from package.json | |
id: vars | |
run: | | |
cd kepler | |
echo ::set-output name=docker_tag::$(cat package.json | jq .version -r) | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: ${{ env.DOCKER_IMAGE }}:${{ steps.vars.outputs.docker_tag }} | |
file: kepler/Dockerfile | |
context: kepler | |
deploy-kepler-on-kosmos: | |
name: Deploy latest Kepler image on Kosmos | |
runs-on: ubuntu-20.04 | |
needs: [publish-kepler-image] | |
environment: Kosmos | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install SCW CLI | |
run: | | |
sudo curl -o /usr/local/bin/scw -L "https://github.com/scaleway/scaleway-cli/releases/download/v2.4.0/scw-2.4.0-linux-x86_64" | |
sudo chmod +x /usr/local/bin/scw | |
- name: Fetch the Kubeconfig file | |
run: scw k8s kubeconfig get ${{ secrets.KAPSULE_ID }} > ./kubeconfig | |
env: | |
KAPSULE_ID: ${{ secrets.KAPSULE_ID }} | |
SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY }} | |
SCW_SECRET_KEY: ${{ secrets.SCW_SECRET_KEY }} | |
SCW_DEFAULT_ORGANIZATION_ID: ${{ secrets.SCW_DEFAULT_ORGANIZATION_ID }} | |
SCW_DEFAULT_PROJECT_ID: ${{ secrets.SCW_DEFAULT_PROJECT_ID }} | |
SCW_DEFAULT_REGION: ${{ secrets.SCW_DEFAULT_REGION }} | |
SCW_DEFAULT_ZONE: ${{ secrets.SCW_DEFAULT_ZONE }} | |
- name: Install Helm 3 | |
run: | | |
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash | |
- name: Get current version from package.json | |
id: vars | |
run: | | |
cd kepler | |
echo ::set-output name=docker_tag::$(cat package.json | jq .version -r) | |
- name: Deploy Kepler using Helm | |
run: | | |
helm repo add kuzzle https://kuzzleio.github.io/helm-charts/ | |
if helm upgrade kepler kuzzle/kuzzle --kubeconfig ./kubeconfig --install --namespace analytics --reuse-values --set image.tag=${{ steps.vars.outputs.docker_tag }} --wait --timeout 1m; then | |
echo "deployment succeeded!" | |
else | |
echo "DEPLOYMENT FAILED! TRYING TO ROLLBACK" | |
helm rollback kepler --namespace analytics --kubeconfig ./kubeconfig | |
exit 1 | |
fi | |