Skip to content

fix: testing workflow #107

fix: testing workflow

fix: testing workflow #107

Workflow file for this run

name: Automated Deployment
on:
push:
branches:
- master
jobs:
about:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: setup nodejs
uses: actions/setup-node@v3
with:
node-version: 16
- name: Jaid/action-sync-node-meta
uses: jaid/action-sync-node-meta@v1.4.0
with:
direction: overwrite-github # default is overwrite-file
githubToken: ${{ secrets.GITHUB }}
upload:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Get Environment Variables
run: |
echo "organization_id=${{ secrets.COCREATE_ORGANIZATION_ID }}" >> $GITHUB_ENV
echo "key=${{ secrets.COCREATE_KEY }}" >> $GITHUB_ENV
echo "host=${{ secrets.COCREATE_HOST }}" >> $GITHUB_ENV
- name: Install @cocreate/cli
run: npm install -g @cocreate/cli
- name: CoCreate CLI Upload
run: coc upload
# docs:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: setup nodejs
# uses: actions/setup-node@v3
# with:
# node-version: 16
# - name: update documentation
# uses: CoCreate-app/CoCreate-docs@master
# env:
# organization_id: ${{ secrets.COCREATE_ORGANIZATION_ID }}
# key: ${{ secrets.COCREATE_KEY }}
# host: ${{ secrets.COCREATE_HOST }}
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
id: semantic
with:
# You can specify specifying version range for the extra plugins if you prefer.
extra_plugins: |
@semantic-release/changelog
@semantic-release/git
@semantic-release/github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # Auto Changog generator
outputs:
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
# package:
# runs-on: ubuntu-latest
# needs: release
# if: needs.release.outputs.new_release_published == 'true'
# env:
# IMAGE: docker.pkg.github.com/cocreate-app/cocreate-node-autoscaler/node-autoscaler
# VERSION: ${{ needs.release.outputs.new_release_version }}
# steps:
# - name: Checkout repository
# uses: actions/checkout@v1
# - name: npm login
# env:
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# run: >
# echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >
# .npmrc
# - name: Login docker registry
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB }}
# run: |
# docker login docker.pkg.github.com -u ${GITHUB_ACTOR} -p ${GITHUB_TOKEN}
# - name: Build docker image
# run: docker build . -t ${IMAGE}:latest -t ${IMAGE}:${VERSION}
# - name: Push docker image
# run: |
# docker push ${IMAGE}:latest
# docker push ${IMAGE}:${VERSION}
build:
runs-on: ubuntu-latest
needs: release
if: needs.release.outputs.new_release_published == 'true'
env:
IMAGE: cocreateapps/cocreate-node-autoscaler
VERSION: ${{ needs.release.outputs.new_release_version }}
steps:
- uses: actions/checkout@v3
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
- name: docker build
id: docker_build
run: docker build . -t ${IMAGE}:latest -t ${IMAGE}:${VERSION}
- name: docker push
id: docker_push
run: |
docker push ${IMAGE}:latest
docker push ${IMAGE}:${VERSION}
deploy:
runs-on: ubuntu-latest
needs:
- release
- build
if: needs.release.outputs.new_release_published == 'true'
env:
VERSION: ${{ needs.release.outputs.new_release_version }}
KUBECONFIG_FILE: ${{ secrets.KUBECONFIG }}
KUBECONFIG: kubeconfig
steps:
- name: Checkout repository
uses: actions/checkout@v1
- name: Get kubectl
run: |
curl -LO https://dl.k8s.io/release/v1.20.0/bin/linux/amd64/kubectl
chmod +x kubectl
- name: Save kubeconfig
env:
KUBECONFIG_FILE: ${{ secrets.KUBECONFIG }}
run: |
echo ${KUBECONFIG_FILE} | base64 -d > ${KUBECONFIG}
- name: Apply deployment
env:
GITHUB_TOKEN: ${{ secrets.GITHUB }}
run: |
./kubectl apply -f nodeautoscaler/deploy/node-auto-scaler-manifests.yaml