Skip to content

Commit

Permalink
Merge pull request #11 from vtex/improve-vtex-install
Browse files Browse the repository at this point in the history
Bum toolbelt to 3.0.0-beta-ci.2
  • Loading branch information
thyarles authored Aug 30, 2022
2 parents 0fe830f + 7bf195a commit 8ecf03c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 47 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
timeout-minutes: 2
steps:
- name: Deploy toolbelt
uses: vtex/action-toolbelt@v3
uses: vtex/action-toolbelt@v4
```
### More advanced, deploy from specific branch and do log in
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
timeout-minutes: 2
steps:
- name: Deploy toolbelt and login
uses: vtex/action-toolbelt@v3
uses: vtex/action-toolbelt@v4
with:
account: YOUR_ACCOUNT
appKey: ${{ secrets.VTEX_TOOLBELT_KEY }}
Expand Down
57 changes: 15 additions & 42 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,73 +20,46 @@ inputs:
description: 'Workspace to start after login, default master'
required: false
default: master
bin:
description: 'Name to call this version of toolbelt'
version:
description: 'Version of VTEX Toolbelt to be installed'
required: false
default: vtex-e2e
git:
description: 'Source repository to clone (org/repo)'
required: false
default: vtex/toolbelt
branch:
description: 'Which branch to use on git'
required: false
default: toolbelt-action
default: 3.0.0-beta-ci.2

runs:
using: 'composite'
steps:

- name: Checkout VTEX Toolbelt
uses: actions/checkout@v3
with:
repository: ${{ inputs.git }}
ref: ${{ inputs.branch }}
path: /home/runner/work/toolbelt

- name: 'Set up Node.js'
uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn
cache-dependency-path: toolbelt/yarn.lock
continue-on-error: true

- name: Get yarn cache path
id: cache-path
run: echo "::set-output name=dir::$(yarn cache dir)"
shell: bash
- name: Cache VTEX Toolbelt
id: cache-toolbelt
uses: actions/cache@v3
with:
path: |
toolbelt
/usr/local/bin/${{ inputs.bin }}
key: ${{ runner.os }}-${{ inputs.git }}-${{ inputs.branch }}-${{ inputs.bin }}


path: ${{ steps.cache-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ inputs.version }}
restore-keys: |
${{ runner.os }}-yarn
- name: Install VTEX Toolbelt
if: steps.cache-toolbelt.outputs.cache-hit != 'true'
# if: steps.cache-toolbelt.outputs.cache-hit != 'true'
run: |
yarn install --frozen-lockfile
yarn build
cp bin/run bin/${{ inputs.bin }}
ln -s $(pwd)/bin/${{ inputs.bin }} /usr/local/bin/
${{ inputs.bin }} whoami || echo "First call to warm it up"
VERSION=$(${{ inputs.bin }} version)
yarn global add vtex@${{ inputs.version }}
VERSION=$(vtex version)
echo ::notice title=VTEX Toolbelt version::$VERSION
working-directory: /home/runner/work/toolbelt
shell: bash

- run: |
bash $GITHUB_ACTION_PATH/entrypoint.sh
shell: bash
env:
VTEX_BIN: ${{ inputs.bin }}
VTEX_ACCOUNT: ${{ inputs.account }}
VTEX_APP_KEY: ${{ inputs.appKey }}
VTEX_APP_TOKEN: ${{ inputs.appToken }}
VTEX_AUTHENTICATE: ${{ inputs.authenticate }}
VTEX_WORKSPACE: ${{ inputs.workspace }}
VTEX_TOOLBELT_GIT: ${{ inputs.git }}
VTEX_TOOLBELT_BRANCH: ${{ inputs.branch }}
shell: bash
branding:
icon: terminal
Expand Down
4 changes: 1 addition & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@ KEY="$VTEX_APP_KEY"
TKN="$VTEX_APP_TOKEN"
WRK=${VTEX_WORKSPACE:-master}
BIN=${VTEX_BIN:-vtex}
GIT=${VTEX_TOOLBELT_GIT:-vtex/toolbelt}
BCH=${VTEX_TOOLBELT_BRANCH:-qe/cypress}
AUT=${VTEX_AUTHENTICATE:-true}
[[ -n $CHECK ]] && AUT='false'

# Show toolbelt version used as GitHub notice
VERSION="$($BIN --version) [from https://github.com/$GIT/tree/$BCH]"
VERSION="$($BIN --version)"
echo ::notice title=Toolbelt version used::$VERSION

# If VTEX_AUTHENTICATE is true
Expand Down

0 comments on commit 8ecf03c

Please sign in to comment.