DEV Community

Cover image for How to Deploy a Framework7 App to AWS via CI/CD
Timo Ernst
Timo Ernst

Posted on • Originally published at

How to Deploy a Framework7 App to AWS via CI/CD

In this tutorial I will explain the easiest way to create an automatic CI/CD pipeline in order to deploy a Framework7 app to AWS. The goal is to have your pipeline automatically build and deploy your project every time you commit a change to the main GitHub branch. In order for you to follow along I assume you already have a F7 app and it is hosted on a public GitHub repository. If you don’t have an application yet, use the F7 CLI to create one. Also, make sure you are signed up to AWS by creating an account there.

1 Create a new S3 Bucket on AWS

In AWS Management Console enter “S3” and select “Buckets”.

AWS S3 Buckets

Then, fill out the form like this:

  • Give it a name
  • Choose a region
  • Deselect “Block all public access”
  • Enable “I acknowledge that the current settings might result in this bucket and the objects within becoming public”
  • Leave the rest as is

Create AWS S3 Bucket

2 Set AWS S3 Bucket Policies

In your bucket list click on the one you just created. Click the “Permissions” tab and then scroll down to Bucket policy and click on “Edit”. Paste in the following code:

        "Version": "2012-10-17",
        "Id": "Policy1589309574299",
        "Statement": [
                "Sid": "Stmt1589309569196",
                "Effect": "Allow",
                "Principal": "*",
                "Action": "s3:GetObject",
                "Resource": "REPLACE_WITH_BUCKET_ARN/*"
Enter fullscreen mode Exit fullscreen mode

Disclaimer: This snippet I shamelessly copied from Anna Aitchison’s excellent article on

Do not save yet! Instead, change the placeholder REPLACE_WITH_BUCKET_ARN under “Ressource”. You can find your ARN in the properties tab in your bucket info. Also do not remove the /* part at the end!

AWS Bucket ARN

3 Enable AWS S3 Static Hosting

  • Go to the Properties tab
  • Scroll down all the way to “Static website hosting”
  • Click on edit
  • Click on enable
  • Under “Index document” put in index.html
  • Leave the rest as is
  • Hit “Save changes”

AWS Enable Static Hosting for S3 Buckets

4 Enable HTTPS

It is a good practice to always force-enable SSL for our Framework7 app, so let’s do that using AWS CloudFront. This will also provide you a nice url. To get started follow these steps:

  • Search for “CloudFront” in your AWS Console search bar and select it
  • Click on “Create Distribution”
  • Under Web, choose “Get Started”
  • In “Origin Domain Name” pick the bucket your just created
  • For Viewer Protocol Policy, choose Redirect HTTP to HTTPS. This will force SSL
  • Leave the rest as is and click on “Create Distribution” in the bottom right corner
  • Give it a few minutes to create the distribution

Create AWS Distribution

Once it’s done click on the newly created distribution. Scroll down to “Domain Name”. It will show something in the form of where 123whatever is a random series of letters and numbers which is specific to your account, so this value will be different! Your website will be available via later when our CI/CD pipeline is done.

5 Create IAM User

In order for our Framework7 CI/CD pipeline to work with GitHub actions we need to provide an access key and an id. For this a new user on AWS must be created.

  • In your AWS Management Console enter “IAM” and then select it
  • On the left click on “users”
  • Click on “Add user”
  • Choose a name
  • Set Access type to “Programmatic access”
  • In the bottom right corner click “Next”
  • On the following page click “Attach existing policies directly”
  • Search for “S3”
  • Select “AmazonS3FullAccess”
  • Click “Next”
  • Skip “Add Tags” and click “Next”
  • Your result should look something like on the screenshot below
  • Click “Create user”

AWS Create User

Important: On the next page copy both Access key and Secret Access key and store them on your computer in a secure way.

AWS Access Key and ID

6 Add Secrets to GitHub

I assume that you have published your Framework7 app to a GitHub repository. If you haven’t done so, do it now.

  • In your repo go to “Settings”
  • Then choose “Secrets” on the left side
  • Click on “New Repository Secret”
  • As name enter AWS_ACCESS_KEY_ID
  • As value enter your access key you received in the previous step
  • Repeat with
    • S3_BUCKET

Tip: To find the correct values for S3_BUCKET and S3_BUCKET_REGION go to your bucket list in AWS, select the bucket and open the “Properties” tab. You will find the values here. In my case S3_BUCKET_REGION is eu-central-1 and S3_BUCKET is arn:aws:s3:::deploy-test-2.

AWS Bucket Region and ARN

7 Setup CI/CD Pipeline on GitHub

  • Go back to your GitHub repo
  • Select “Actions” from the top bar
  • Click on Skip this and set up a workflow yourself
  • Paste in the following code:
  name: Framework7 AWS Deploy
  on: [push]
  runs-on: ubuntu-latest
  steps: - uses: actions/checkout@v2

        - name: Install dependencies
          run: npm install

        - name: Build
          run: npm run build

        - name: Deploy
          uses: reggionick/s3-deploy@v3
            folder: www
            bucket: ${{ secrets.S3_BUCKET }}
            bucket-region: ${{ secrets.S3_BUCKET_REGION }}
            delete-removed: true
            no-cache: true
            private: true
Enter fullscreen mode Exit fullscreen mode
  • Click on “Start Commit” (Green button)
  • Click on “Commit new file”
  • Go back to Actions tab
  • You should now see how:
    • The build is created
    • The app is pushed to AWS

8 View Your Framework7 App

Let GitHub Action do its job. This will take a couple minutes! It will show the status for each workflow in the table on that page. Once it’s done open your deployed Framework7 app like this:

Important: Replace 123whatever with the correct ID of your app. See step 4 in this tutorial what your personal url will be.


We have now fully created a CI/CD pipeline with GitHub Actions and successfully deployed the Framework7 app. Every time you push to your main branch in GitHub a new build is automatically created and the update is deployed to AWS. Please let me know if this tutorial worked for you in the comments down below :)

You can find more Framework7 tutorials on my YouTube channel

Top comments (2)

jannunen profile image
Jarmo Annunen

I installed the aws CLI and managed to deploy the files manually. Nowadays it seems that you have to create an access point for the S3 bucket and by using that access point ARN, you will be able to deploy.

jannunen profile image
Jarmo Annunen

Hi, I'm getting this error when the deploying task is running in Github:

Unexpected error: (InvalidARN) ARN accountID does not match regex "[0-9]{12}", aborting upload for assets/xxxx.js

Tried googling around but without much succeess. Do you have any pointers where I should head to?