Code Monkey home page Code Monkey logo

zcli-action's Introduction

ZCLI Action

Github Action to deploy Zendesk Apps using ZCLI.

๐Ÿ“‹ Table of contents

๐Ÿ“ฆ Installation

Install the dependencies

yarn install

๐Ÿ” Change the Action

The action.yml defines the inputs and output for your action.

Update the action.yml and index.js if you want to make changes to the action.

โŒจ๏ธ Change the Code

Most toolkit and CI/CD operations involve async operations so the action is run in an async function.

const core = require('@actions/core');
...

async function run() {
  try {
      ...
  }
  catch (error) {
    core.setFailed(error.message);
  }
}

run()

๐Ÿš€ Usage

You can now consume the action by referencing the release branch, e.g.: @v1

uses: eteg/zcli-action@v1

This is a complete example of the action usage for development purposes.:

name: CD Zendesk

on:
  # Enables manual invocation of the workflow from the github action user interface
  workflow_dispatch:
  pull_request:
    branches:
      - main
      - develop
    types: [closed]

jobs:
  deploy:
    runs-on: ubuntu-latest
    environment: ${{github.ref_name == 'main' && 'production' || 'staging'}}

    strategy:
      matrix:
        node-version: [16.x]

    env:
      ZENDESK_SUBDOMAIN: ${{ secrets.ZENDESK_SUBDOMAIN }}
      ZENDESK_EMAIL: ${{ secrets.ZENDESK_EMAIL }}
      ZENDESK_API_TOKEN: ${{ secrets.ZENDESK_API_TOKEN }}

    steps:
      - name: Checkout the code
        uses: actions/checkout@v3

      - name: Setup node version from .nvmrc file
        uses: actions/setup-node@v3
        id: setup-node
        with:
          node-version-file: ".nvmrc"
          cache: "yarn"

      - name: Setup ZCLI
        uses: eteg/zcli-action@v3
        with:
          PATH: "dist"

NOTE: You must setup env variables in Settings > Environments

โœ‰๏ธ Package for distribution

GitHub Actions will run the entry point from the action.yml. Packaging assembles the code into one file that can be checked in to Git, enabling fast and reliable execution and preventing the need to check in node_modules.

Actions are run from GitHub repos. Packaging the action will create a packaged action in the dist folder.

Run prepare for distribution

yarn prepare

Since the packaged index.js is run from the dist folder.

git add dist

๐Ÿคฏ Create a release branch

Users shouldn't consume the action from master since that would be latest code and actions can break compatibility between major versions.

Checkin to the v1 release branch

git checkout -b v1
git commit -a -m "v1 release"
git push origin v1

Your action is now published! ๐Ÿš€

๐Ÿ“œ License

This project have no license. You're under no obligation to choose a license. However, without a license, the default copyright laws apply, meaning that you retain all rights to your source code and no one may reproduce, distribute, or create derivative works from your work. Github licensing page.

zcli-action's People

Contributors

coodyme avatar dependabot[bot] avatar pedrobeto avatar rodrigovmoura avatar viniciusmarch avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

zcli-action's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.