Skip to content

fix prod pipeline, step outputs #3

fix prod pipeline, step outputs

fix prod pipeline, step outputs #3

name: cd-dev-botnorrea-v2-telegram
on:
push:
branches: [master]
jobs:
unit-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ["18.x"]
steps:
- uses: actions/checkout@v3
# Obtener el nombre del autor del commit
- name: Get commit author
id: get_commit_author
run: |
author=$(git log -1 --format='%an')
echo "::set-output name=autor_commit::$author"
# Create new git tag
- name: Create new git tag
if: ${{ steps.obtener_autor_commit.outputs.autor_commit != 'botnorrea-v2' }}
run: |
git config --global user.email "${{ secrets.BOTNORREA_V2_EMAIL }}"
git config --global user.name "${{ secrets.BOTNORREA_V2_NAME }}"
git tag -a "v$(npm run version)" -m "Deploy by ${{ secrets.BOTNORREA_V2_NAME }}"
git push origin master "v$(npm run version)"
# Deploy to production
- name: Using Node.js ${{ matrix.node-version }}
if: ${{ steps.obtener_autor_commit.outputs.autor_commit == 'botnorrea-v2' }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
if: ${{ steps.obtener_autor_commit.outputs.autor_commit == 'botnorrea-v2' }}
run: |
npm install -g serverless
npm i
- name: Create JSON
if: ${{ steps.obtener_autor_commit.outputs.autor_commit == 'botnorrea-v2' }}
id: create-json
uses: jsdaniell/[email protected]
with:
name: "dev.json"
json: ${{ secrets.CONFIG_FILE_PROD }}
dir: "config/"
- name: Setup credentials
if: ${{ steps.obtener_autor_commit.outputs.autor_commit == 'botnorrea-v2' }}
run: serverless config credentials --provider aws --key ${{ secrets.KEY_ID }} --secret ${{ secrets.SECRET_ACCESS_KEY }} --profile ${{ secrets.PROFILE }}
- name: Deploy
if: ${{ steps.obtener_autor_commit.outputs.autor_commit == 'botnorrea-v2' }}
run: npm run prod:deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS_KEY }}