chore: Disjoin slack webhook of deployment action #5
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: serverless deployment | |
on: | |
push: | |
branches: [master] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Install dependencies | |
run: npm install | |
- name: Configure credentials | |
run: serverless config credentials --provider aws --key $AWS_ACCESS_KEY_ID --secret $AWS_SECRET_ACCESS_KEY | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Set environment variables | |
uses: jsdaniell/create-json@1.1.2 | |
with: | |
name: '.env.prod.json' | |
json: ${{ secrets.ENV_PROD_JSON }} | |
- name: Deploy | |
run: npm run deploy | |
notify: | |
needs: deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Send deployment notification | |
uses: rtCamp/action-slack-notify@v2.2.0 | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_CHANNEL: logs | |
SLACK_USERNAME: github-actions | |
SLACK_MESSAGE: | | |
*${{ github.repository }}* has been deployed to *${{ github.ref }}* by *${{ github.actor }}* | |
${{ github.event.head_commit.message }} | |
${{ github.event.head_commit.url }} |