Skip to content

Latest commit

 

History

History
104 lines (82 loc) · 3.32 KB

README.md

File metadata and controls

104 lines (82 loc) · 3.32 KB

Toolbelt action

This GitHub action deploys the VTEX Toolbelt and can do log in using KEY/TOKEN. It can be useful to automate you CI/CD pipelines or just to schedules day-to-day tasks like cleaning dirty workspaces.

Features

  • Deploy VTEX Toolbelt (you can customize the repository/branch)
  • Change the tool name, i.e. instead of vtex it can go by vtex-e2e
  • Login using app key and app token
  • Cache resources to do the next deploy faster
  • Check every step and stop if anything goes wrong

Usage

Most basic one, just deploy the VTEX Toolbelt

# toolbelt-workflow.yml
name: [QE] Deploy Toolbelt

on:
  push:
    branches:
      - master
      - main
  workflow_dispatch:

jobs:
  deploy:
    name: Toolbelt deploy and login
    runs-on: ubuntu-latest
    timeout-minutes: 2
    steps:
      - name: Deploy toolbelt
        uses: vtex/action-toolbelt@v8

More advanced, deploy from specific branch and do log in

If you want to log in, please, add two secrets on your repository secrets:

  1. One for the app key, in our example it is VTEX_TOOLBELT_KEY
  2. Other for the token, in our example it is VTEX_TOOLBELT_TOKEN

Next you need to set up your workflow like the example bellow, and that's it.

# toolbelt-workflow.yml
name: [QE] Deploy Toolbelt

on:
  push:
    branches:
      - master
      - main
  workflow_dispatch:

jobs:
  deploy:
    name: Toolbelt deploy and login
    runs-on: ubuntu-latest
    timeout-minutes: 2
    steps:
      - name: Deploy toolbelt and login
        uses: vtex/action-toolbelt@v8
        with:
          account: YOUR_ACCOUNT
          appKey: ${{ secrets.VTEX_TOOLBELT_KEY }}
          appToken: ${{ secrets.VTEX_TOOLBELT_TOKEN }}
          authenticate: true        # defaults to true, but it'll be false if
                                    # any of account, appKey or appToken is missing
          workspace: master         # defaults to master
          bin: vtex                 # defaults to vtex
          version: 3.0.0-beta-ci.3  # defaults to 3.0.0-beta-ci.3

      - name: Do something after the login
        # The call name bellow must be the same given as *with: bin*
        run: vtex workspace ls

      - name: Logout
        # The call name bellow must be the same given as *with: bin*
        run: vtex logout

Output

The output of this workflow will be something like that:

::notice title=Toolbelt version used::vtex/3.0.0 linux-x64 node-v16.13.0 [from https://github.com/vtex/toolbelt/tree/]
===> Fetching VTEX token... done.
===> Creating session.json... done.
===> Creating workspace.json... done.
===> Checking authentication... done.
14:01:15.234 - info: Logged into account as vtexkey-account-ABC at production workspace master

Credits

This action was made based on this issue discussion inspiration and I'll give my thanks to:

Together we can do more!