Skip to content

Commit

Permalink
Create a CD to Netlify (#18)
Browse files Browse the repository at this point in the history
* Add CD

* Fix

* Update flutter version

* Update actions

* Use stable of flutter

* Add making .env

* Delete permissions

* Reflect review
  • Loading branch information
Mdaiki0730 authored Jul 18, 2024
1 parent 8db3020 commit 0911a8e
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Deploy Netlify

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build-and-deploy:
runs-on: ubuntu-22.04
timeout-minutes: 10


steps:
- uses: actions/checkout@v3

- uses: subosito/[email protected]
with:
flutter-version: '3.22.2'

- name: Make .env
working-directory: flutter_bird_app
run: |
touch .env
echo WALLET_CONNECT_PROJECT_ID=${{secrets.WALLET_CONNECT_PROJECT_ID}} >> .env
- name: Show version
working-directory: flutter_bird_app
run: flutter --version

- name: Install packages
working-directory: flutter_bird_app
run: flutter pub get

- name: Build
working-directory: flutter_bird_app
run: flutter build web

- name: Set GitHub Deployment Environment
id: github_deployment_environment
run: |
if [ "$GITHUB_EVENT_NAME" = "push" ]; then
echo "GITHUB_DEPLOYMENT_ENVIRONMENT=Netlify prd" >> "${GITHUB_OUTPUT}"
else
echo "GITHUB_DEPLOYMENT_ENVIRONMENT=Netlify Preview" >> "${GITHUB_OUTPUT}"
fi
- name: Deploy to Netlify
uses: nwtgck/[email protected]
with:
publish-dir: './flutter_bird_app/build/web'
production-branch: master
github-deployment-environment: ${{ steps.github_deployment_environment.outputs.GITHUB_DEPLOYMENT_ENVIRONMENT }}
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: ${{ github.event.head_commit.message || github.event.pull_request.title }}
alias: deploy-preview-${{ github.event.number }}
fails-without-credentials: true
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_PAT }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

1 comment on commit 0911a8e

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.