Automating with GitHub Actions
GitHub Pages is another place where we can host static sites by creating a GitHub repository. In order for this to work, all you need is a GitHub account and a repository for your project. We will be using GitHub Actions to automatically build and deploy our Flutter web application to GitHub Pages. First, we will start by creating a GitHub action that will build and deploy our application.
Writing a GitHub action for deployment
We define the configuration for a GitHub action in a .yml
file inside the .github/workflows
directory in our repository. Let’s create deploy.yml
inside .github/workflows
in our repository and add the following configuration:
name: Deploy to GitHub Pages on: push: branches: [ main ] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 ...