Created
July 13, 2024 21:19
-
-
Save kavicastelo/4d7d9db67fd8f069a22e80785e606778 to your computer and use it in GitHub Desktop.
single workflow to build and deploy angular project to netlify
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: Build and Deploy to Netlify | |
on: | |
push: | |
branches: | |
- main # Or the branch you want to trigger the deployment | |
jobs: | |
build: | |
if: contains(github.event.head_commit.message, '[run-all]') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' # Or the version your project requires | |
- name: Install dependencies | |
working-directory: client | |
run: npm install | |
- name: Install Netlify CLI | |
working-directory: client | |
run: npm install netlify-cli --save-dev | |
- name: Build project | |
working-directory: client | |
run: npm run build --prod --output-path=dist/client | |
- name: Verify npx | |
run: npx --version | |
- name: Deploy to Netlify | |
working-directory: client | |
run: npx netlify deploy --dir=dist/client --prod | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment