Бот доставки действий Github
Мы настроили действия Github для конвейеров ci/cd, и несколько дней назад они работали должным образом. Мы используем комментарии GitHub pr (/deploy staging) для развертывания кода в корзину AWS S3, и все работает, как и ожидалось. Но теперь, когда мы комментируем pr (запрос на вытягивание), развертывание не запускается, а запускается в полночь через 10 часов.. Вот мои файлы.
рабочие процессы /deploy.yml
имя: 'Развернуть' на: ['развертывание']
задания: развертывание: имя: 'Развернуть в ${{ github.event.deployment.environment }}' запуск: ubuntu-последние шаги:
- name: Deployment pending
uses: deliverybot/deployment-status@master
with:
state: pending
token: '${{ github.token }}'
- name: Copy Repo Files
uses: actions/checkout@v1
- name: Set Variables
id: variables
run: |
if [ "$ENVIRONMENT" == "production" ]; then
echo ::set-output name=DEPLOY_BUCKET::$PROD_BUCKET
export PUBLIC_URL=https://app.virtualcombine.com/
else
echo ::set-output name=DEPLOY_BUCKET::$STAGING_BUCKET
export PUBLIC_URL=https://staging-app.virtualcombine.com/
fi
export VERSION="$(node -pe "require('./package.json').version")"
export COMMIT="$(sed -e 's/^\(.\{9\}\).*/\1/' <<< $(git rev-parse --short HEAD))"
echo ::set-output name=SOURCE_PATH::$VERSION/$COMMIT/$ENVIRONMENT
env:
ENVIRONMENT: ${{ github.event.deployment.environment }}
PROD_BUCKET: ${{ secrets.PROD_S3_UI_BUCKET }}
STAGING_BUCKET: ${{ secrets.STAGING_S3_UI_BUCKET }}
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: 'Deploy to ${{ github.event.deployment.environment }}'
run: |
aws s3 sync s3://${SOURCE_BUCKET_NAME}/${SOURCE_BUCKET_PATH} s3://${DEST_BUCKET_NAME} --delete
env:
SOURCE_BUCKET_NAME: ${{ secrets.AWS_S3_RELEASE_BUCKET }}
SOURCE_BUCKET_PATH: ${{ steps.variables.outputs.SOURCE_PATH }}
DEST_BUCKET_NAME: ${{ steps.variables.outputs.DEPLOY_BUCKET }}
- name: 'Deployment success'
if: success()
uses: 'deliverybot/deployment-status@master'
with:
state: 'success'
token: '${{ github.token }}'
- name: 'Deployment failure'
if: failure()
uses: 'deliverybot/deployment-status@master'
with:
state: 'failure'
token: '${{ github.token }}'
Рабочие процессы/mail.yml
название: Пользовательский интерфейс приложения Virtual Combine
on: push: ветки: - 'выпуск/ ' - 'исправление/ '
jobs: lint_test: name: Затронутые запуски Lint & Test: ubuntu-latest steps: — name: Copy Repo Files use: действия/ checkout@v1
- name: Yarn Install
uses: bahmutov/npm-install@v1
with:
useLockFile: true
- name: Setup Env Files
run: |
touch src/config/env-urls.js
echo "$ENV_URL_FILE" > src/config/env-urls.js
env:
ENV_URL_FILE: ${{ secrets.ALPHA_URL_FILE }}
- name: Lint Affected
run: yarn lint
- name: Test Affected
run: yarn test
build_staging: name: Требования к промежуточной сборке: — lint_test
runs-on: ubuntu-latest
steps:
- name: Copy Repo Files
uses: actions/checkout@v1
- name: Yarn Install
uses: bahmutov/npm-install@v1
with:
useLockFile: true
- name: Setup Env Files
run: |
touch src/config/env-urls.js
echo "$ENV_URL_FILE" > src/config/env-urls.js
env:
ENV_URL_FILE: ${{ secrets.ALPHA_URL_FILE }}
- name: Set Version
id: version
run: |
if [ "$EVENT" == "push" ]; then
export COMMIT="$(sed -e 's/^\(.\{9\}\).*/\1/' <<< "$SHA")"
else
export COMMIT="$(sed -e 's/^\(.\{9\}\).*/\1/' <<< "$PR_SHA")"
fi
export VERSION="$(node -pe "require('./package.json').version")"
echo ::set-output name=COMMIT::$COMMIT
echo ::set-output name=VERSION::$VERSION
echo ::set-output name=DEST_DIR::$VERSION/$COMMIT/staging
env:
EVENT: ${{ github.event_name }}
SHA: ${{ github.sha }}
PR_SHA: ${{ github.event.pull_request.head.sha }}
- name: Build
run: yarn build
env:
DEPLOY_COMMIT: ${{ steps.version.outputs.COMMIT }}
- name: Create Version File
run: |
echo "$VERSION/$COMMIT" > dist/apps/web/version.txt
env:
VERSION: ${{ steps.version.outputs.VERSION }}
COMMIT: ${{ steps.version.outputs.COMMIT }}
- name: Sync to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --quiet --delete
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_RELEASE_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-west-2'
SOURCE_DIR: 'dist/apps/web'
DEST_DIR: ${{ steps.version.outputs.DEST_DIR }}
build_production: имя: Потребности сборки для производства: - lint_test
runs-on: ubuntu-latest
steps:
- name: Copy Repo Files
uses: actions/checkout@v1
- name: Yarn Install
uses: bahmutov/npm-install@v1
with:
useLockFile: true
- name: Setup Env Files
run: |
touch src/config/env-urls.js
echo "$ENV_URL_FILE" > src/config/env-urls.js
env:
ENV_URL_FILE: ${{ secrets.PROD_URL_FILE }}
- name: Set Version
id: version
run: |
if [ "$EVENT" == "push" ]; then
export COMMIT="$(sed -e 's/^\(.\{9\}\).*/\1/' <<< "$SHA")"
else
export COMMIT="$(sed -e 's/^\(.\{9\}\).*/\1/' <<< "$PR_SHA")"
fi
export VERSION="$(node -pe "require('./package.json').version")"
echo ::set-output name=VERSION::$VERSION
echo ::set-output name=COMMIT::$COMMIT
echo ::set-output name=DEST_DIR::$VERSION/$COMMIT/production
env:
EVENT: ${{ github.event_name }}
SHA: ${{ github.sha }}
PR_SHA: ${{ github.event.pull_request.head.sha }}
- name: Build
run: yarn build
env:
DEPLOY_COMMIT: ${{ steps.version.outputs.COMMIT }}
- name: Create Version File
run: |
echo "$VERSION/$COMMIT" > dist/apps/web/version.txt
env:
VERSION: ${{ steps.version.outputs.VERSION }}
COMMIT: ${{ steps.version.outputs.COMMIT }}
- name: Sync to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --quiet --delete
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_RELEASE_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-west-2'
SOURCE_DIR: 'dist/apps/web'
DEST_DIR: ${{ steps.version.outputs.DEST_DIR }}
развернуть.yml
постановка: среда: постановка production_environment: true
производство: среда: производство производство_среда: правда