Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

143 image region select app #16

Merged
merged 6 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/contentful-image-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'on':
push:
branches:
- main
paths:
- img-region-select-app/**
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: |
cd img-region-select-app
npm ci
- name: Set Secrets and Change Dir
run: |
cd img-region-select-app
echo "REACT_APP_CONTENTFUL_SPACE=${{ secrets.STAGING_CONTENTFUL_SPACE }}" >> .env
echo "REACT_APP_CONTENTFUL_ACCESS_TOKEN=${{ secrets.STAGING_CONTENTFUL_ACCESS_TOKEN }}" >> .env
- name: Build
run: |
cd img-region-select-app
npm run build
- name: Deploy
env:
CONTENTFUL_ACCESS_TOKEN: ${{ secrets.STAGING_CONTENTFUL_ACCESS_TOKEN }}
CONTENTFUL_ORG_ID: ${{ secrets.STAGING_CONTENTFUL_ORG_ID }}
CONTENTFUL_APP_DEF_ID: ${{ secrets.STAGING_CONTENTFUL_APP_DEF_ID }}
run: |
cd img-region-select-app
npm run upload-ci
35 changes: 35 additions & 0 deletions .github/workflows/contentful-image-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
'on':
release:
types: [released]
paths:
- img-region-select-app/**
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: |
cd img-region-select-app
npm ci
- name: Set Secrets and Change Dir
run: |
cd img-region-select-app
echo "REACT_APP_CONTENTFUL_SPACE=${{ secrets.CONTENTFUL_SPACE }}" >> .env
echo "REACT_APP_CONTENTFUL_ACCESS_TOKEN=${{ secrets.CONTENTFUL_ACCESS_TOKEN }}" >> .env
- name: Build
run: |
cd img-region-select-app
npm run build
- name: Deploy
env:
CONTENTFUL_ACCESS_TOKEN: ${{ secrets.CONTENTFUL_ACCESS_TOKEN }}
CONTENTFUL_ORG_ID: ${{ secrets.CONTENTFUL_ORG_ID }}
CONTENTFUL_APP_DEF_ID: ${{ secrets.CONTENTFUL_APP_DEF_ID }}
run: |
cd img-region-select-app
npm run upload-ci
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
push:
branches:
- main
paths:
- qr-code-app/**
jobs:
build_and_deploy:
runs-on: ubuntu-latest
Expand All @@ -12,14 +14,22 @@ jobs:
with:
node-version: '20'
- name: Install dependencies
run: npm ci
run: |
cd qr-code-app
npm ci
- name: Set Secrets and Change Dir
run: echo "REACT_APP_DOMAIN=${{ secrets.STAGING_REACT_APP_DOMAIN }}" >> .env
run: |
cd qr-code-app
echo "REACT_APP_DOMAIN=${{ secrets.STAGING_REACT_APP_DOMAIN }}" >> .env
- name: Build
run: npm run build
run: |
cd qr-code-app
npm run build
- name: Deploy
env:
CONTENTFUL_ACCESS_TOKEN: ${{ secrets.STAGING_CONTENTFUL_ACCESS_TOKEN }}
CONTENTFUL_ORG_ID: ${{ secrets.STAGING_CONTENTFUL_ORG_ID }}
CONTENTFUL_APP_DEF_ID: ${{ secrets.STAGING_CONTENTFUL_APP_DEF_ID }}
run: npm run upload-ci
run: |
cd qr-code-app
npm run upload-ci
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
'on':
release:
types: [released]
paths:
- qr-code-app/**
jobs:
build_and_deploy:
runs-on: ubuntu-latest
Expand All @@ -11,14 +13,22 @@ jobs:
with:
node-version: '20'
- name: Install dependencies
run: npm ci
run: |
cd qr-code-app
npm ci
- name: Set Secrets and Change Dir
run: echo "REACT_APP_DOMAIN=${{ secrets.REACT_APP_DOMAIN }}" >> .env
run: |
cd qr-code-app
echo "REACT_APP_DOMAIN=${{ secrets.REACT_APP_DOMAIN }}" >> .env
- name: Build
run: npm run build
run: |
cd qr-code-app
npm run build
- name: Deploy
env:
CONTENTFUL_ACCESS_TOKEN: ${{ secrets.CONTENTFUL_ACCESS_TOKEN }}
CONTENTFUL_ORG_ID: ${{ secrets.CONTENTFUL_ORG_ID }}
CONTENTFUL_APP_DEF_ID: ${{ secrets.CONTENTFUL_APP_DEF_ID }}
run: npm run upload-ci
run: |
cd qr-code-app
npm run upload-ci
21 changes: 21 additions & 0 deletions .github/workflows/image-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'on':
pull_request:
paths:
- img-region-select-app/**
jobs:
build_and_preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: |
cd img-region-select-app
npm ci
- name: Build
run: |
cd img-region-select-app
npm run build
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
'on': pull_request
'on':
pull_request:
paths:
- qr-code-app/**
jobs:
build_and_preview:
runs-on: ubuntu-latest
Expand All @@ -9,6 +12,10 @@ jobs:
with:
node-version: '20'
- name: Install dependencies
run: npm ci
run: |
cd qr-code-app
npm ci
- name: Build
run: npm run build
run: |
cd qr-code-app
npm run build
24 changes: 24 additions & 0 deletions img-region-select-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# dotenv environment variables file
.env
.env.*
!.env*.example

# misc
.DS_Store

npm-debug.log*
yarn-debug.log*
yarn-error.log*
1 change: 1 addition & 0 deletions img-region-select-app/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@contentful:registry=https://registry.npmjs.org
81 changes: 81 additions & 0 deletions img-region-select-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
This project was bootstrapped with [Create Contentful App](https://github.com/contentful/create-contentful-app).

## How to use

Execute create-contentful-app with npm, npx or yarn to bootstrap the example:

```bash
# npx
npx create-contentful-app --typescript

# npm
npm init contentful-app -- --typescript

# Yarn
yarn create contentful-app --typescript
```

## Available Scripts

In the project directory, you can run:

#### `npm start`

Creates or updates your app definition in Contentful, and runs the app in development mode.
Open your app to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

#### `npm run build`

Builds the app for production to the `build` folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

#### `npm run upload`

Uploads the build folder to contentful and creates a bundle that is automatically activated.
The command guides you through the deployment process and asks for all required arguments.
Read [here](https://www.contentful.com/developers/docs/extensibility/app-framework/create-contentful-app/#deploy-with-contentful) for more information about the deployment process.

#### `npm run upload-ci`

Similar to `npm run upload` it will upload your app to contentful and activate it. The only difference is
that with this command all required arguments are read from the environment variables, for example when you add
the upload command to your CI pipeline.

For this command to work, the following environment variables must be set:

- `CONTENTFUL_ORG_ID` - The ID of your organization
- `CONTENTFUL_APP_DEF_ID` - The ID of the app to which to add the bundle
- `CONTENTFUL_ACCESS_TOKEN` - A personal [access token](https://www.contentful.com/developers/docs/references/content-management-api/#/reference/personal-access-tokens)

## Libraries to use

To make your app look and feel like Contentful use the following libraries:

- [Forma 36](https://f36.contentful.com/) – Contentful's design system
- [Contentful Field Editors](https://www.contentful.com/developers/docs/extensibility/field-editors/) – Contentful's field editor React components

## Using the `contentful-management` SDK

In the default create contentful app output, a contentful management client is
passed into each location. This can be used to interact with Contentful's
management API. For example

```js
// Use the client
cma.locale.getMany({}).then((locales) => console.log(locales));
```

Visit the [`contentful-management` documentation](https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library)
to find out more.

## Learn More

[Read more](https://www.contentful.com/developers/docs/extensibility/app-framework/create-contentful-app/) and check out the video on how to use the CLI.

Create Contentful App uses [Create React App](https://create-react-app.dev/). You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started) and how to further customize your app.
Loading