feat: add netlify deployment workflows #2
Workflow file for this run
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: Deploy a netlify application | |
on: | |
workflow_call: | |
inputs: | |
application: | |
type: string | |
required: true | |
artifact: | |
type: string | |
required: true | |
environment: | |
type: string | |
required: true | |
version: | |
type: string | |
required: false | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ${{ inputs.artifact }} | |
path: ./build | |
- uses: sencrop/github-workflows/actions/find-deployed-version | |
id: deplyed_version | |
with: | |
environment: ${{ inputs.environment }} | |
from: git | |
- name: Notify deployment in progress | |
uses: sencrop/github-workflows/actions/notify-deployment-in-progress@master | |
with: | |
service: ${{ inputs.application }} | |
environment: ${{ inputs.environment }} | |
dd_api_key: ${{ secrets.DD_API_KEY }} | |
former_version: ${{ steps.deployed_version.outputs.version }} | |
new_version: ${{ inputs.version }} | |
slack_bot_token: ${{ secrets.SLACK_BOT_TOKEN }} | |
- uses: sencrop/github-workflows/actions/add-github-tag | |
with: | |
tag: ${{ inputs.environment }} | |
- name: Deploy to Netlify | |
uses: nwtgck/actions-netlify@v3 | |
with: | |
publish-dir: ./build | |
# production-branch should not be used as production deploy are triggered on release | |
production-deploy: ${{ inputs.environment == "production" }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
deploy-message: "Deploy from GitHub Actions" | |
netlify-config-path: "./netlify.toml" | |
enable-pull-request-comment: false | |
enable-commit-comment: true | |
overwrites-pull-request-comment: false | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
timeout-minutes: 2 | |
- name: Track deployment time | |
uses: sencrop/github-workflows/actions/track-deployment-time@master | |
with: | |
service: ${{ inputs.application }} | |
environment: ${{ inputs.environment }} | |
dd_api_key: ${{ secrets.DD_API_KEY }} |