fix output reference #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: cd-prod-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 | |
id: create_new_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 }}" | |
npm version minor | |
echo "::set-output name=new_tag::$(git describe --tags --abbrev=0)" | |
# Push the new git tag | |
- name: Push the new git tag | |
if: ${{ steps.obtener_autor_commit.outputs.autor_commit != 'botnorrea-v2' }} | |
run: | | |
git push origin master | |
git push origin ${{ steps.create_new_tag.outputs.new_tag }} | |
# 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 }} |