-
Notifications
You must be signed in to change notification settings - Fork 0
YAML structure (JA)
mohemohe edited this page May 27, 2023
·
7 revisions
version: 1
lscbuildのYAMLフォーマットのバージョンを指定します。
2022/07/01現在、 1
のみ対応しています。
jobs:
foo:
# job object
bar:
# job object
ジョブを定義します。
配下のオブジェクトのキーをジョブの名前として扱います。
jobs:
foo:
steps:
- cmd: n lts
- cmd: yarn install
- cmd: yarn test
- cmd: yarn build
- cmd: aws s3 sync ./dist/ s3://hoge-bucket/
ジョブ中に実行する操作を配列で指定します。
jobs:
foo:
steps:
- name: list files
cmd: ls -la
ジョブ中に実行する操作の名前を指定します。
未指定の場合は、 job.steps[].cmd
をログに出力します。
jobs:
foo:
steps:
- cmd: ls -la
ジョブ中に実行するコマンドを指定します。
jobs:
foo:
steps:
- cmd: ls -la
dir: /usr/local
ジョブ中に実行するコマンドの作業ディレクトリを指定します。
jobs:
foo:
steps:
- cmd: yarn build
env:
- NODE_ENV=production
ジョブ中に実行するコマンドの環境変数を指定します。
jobs:
foo:
steps:
- cmd: yarn install
if:
- file:
exists: ./package.json
- file:
exists: ./yarn.lock
- directory:
missing: ./node_modules
特定の条件の場合のみ指定した操作を実行します。
複数の条件を記載した場合はAND条件で判定します。
jobs:
foo:
steps:
- cmd: yarn run clean
if:
- directory:
exists: ./dist
指定したディレクトリが存在する場合のみ操作を実行します。
jobs:
foo:
steps:
- cmd: yarn install
if:
- directory:
missing: ./node_modules
指定したディレクトリが存在しない場合のみ操作を実行します。
jobs:
foo:
steps:
- cmd: yarn install
if:
- file:
exists: ./package.json
指定したファイルが存在する場合のみ操作を実行します。
jobs:
foo:
steps:
- cmd: ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
if:
- file:
missing: /etc/resolv.conf
指定したファイルが存在しない場合のみ操作を実行します。
jobs:
foo:
env:
- SLACK_WEBHOOK_URL=https://hooks.slack.com/services/XXXXXXXXX/YYYYYYYYY/ZZZZZZZZZZZZZZZZZZZZZZZZ
steps:
- cmd: |-
cat << EOS | curl -d - -X POST $SLACK_WEBHOOK_URL
{ "text": "build start" }
EOS
if:
- env:
- CI=1
- cmd: yarn install
- cmd: yarn build
- cmd: |-
cat << EOS | curl -d - -X POST $SLACK_WEBHOOK_URL
{ "text": "build success" }
EOS
if:
- env:
- CI=1
指定した環境変数と値の組み合わせの場合のみ操作を実行します。
jobs:
foo:
shell: /bin/zsh
steps:
- cmd: echo $SHELL
指定したファイルをシェルとして使用します。
jobs:
foo:
env:
- DEPLOY_ENV=dev
steps:
- cmd: cp ${DEPLOY_ENV}.env .env
- cmd: yarn build
- cmd: yarn deploy
ジョブ全体で適用される環境変数を指定します。