Skip to content

Commit

Permalink
Create CI workflow
Browse files Browse the repository at this point in the history
Minor other tidy ups
  • Loading branch information
viral32111 committed Aug 4, 2023
1 parent 9e2b099 commit fdae586
Show file tree
Hide file tree
Showing 8 changed files with 265 additions and 692 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
]
},
"ignorePatterns": [
"./node_modules/",
"./browser/scripts/"
"node_modules/",
"browser/scripts/"
]
}
87 changes: 87 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: CI

on:
push:
paths:
- 'browser/**/*'
- 'functions/**/*'
- 'scripts/**/*'
- '*.json'
- '*.toml'
- '.github/workflows/ci.yml'
branches:
- '**'
tags:
- '*.*.*'
workflow_dispatch:

env:
ARTIFACT_NAME: oauth-demo

jobs:
build:
name: Build
runs-on: ubuntu-22.04
permissions:
contents: read
steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install dependencies
run: npm clean-install

- name: Lint code
run: npm run lint

- name: Build project
run: npm run build

- name: Upload browser artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
path: browser/

deploy:
name: Deploy
runs-on: ubuntu-22.04
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
needs: build
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deploy-to-pages.outputs.page_url }}
concurrency:
group: github-pages
cancel-in-progress: false
steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Setup GitHub Pages
id: setup-pages
uses: actions/configure-pages@v3

- name: Download browser artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
path: browser

- name: Upload to GitHub Pages
uses: actions/upload-pages-artifact@v2
with:
path: browser

- name: Deploy to GitHub Pages
id: deploy-to-pages
uses: actions/deploy-pages@v2
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
![GitHub release downloads](https://img.shields.io/github/downloads/viral32111/oauth-demo/total?label=Downloads)
![GitHub commit activity](https://img.shields.io/github/commit-activity/m/viral32111/oauth-demo?label=Commits)

Examples of OAuth integration with various services.
This is a web application running on [Cloudflare Pages](https://pages.cloudflare.com) and [Cloudflare Workers](workers.cloudflare.com) for demonstrating integrations of the [OAuth 2.0 standard](https://oauth.net/2/) with popular providers.

## ⚖️ License

Expand Down
15 changes: 7 additions & 8 deletions browser/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en-GB">
<html lang="en-gb">
<head>
<!-- Tab title -->
<title>Get Started - OAuth Demo</title>
Expand All @@ -13,7 +13,7 @@
<meta name="description" content="Demonstration of OAuth 2.0 integration with various providers.">
<meta name="subject" content="Demonstration of OAuth 2.0 integration with various providers.">
<meta name="keywords" content="oauth,oauth2,integration,example,demonstration,viral32111">
<meta name="language" content="en_gb">
<meta name="language" content="en-gb">
<meta name="author" content="viral32111 <contact@viral32111.com>">
<meta name="owner" content="viral32111 <contact@viral32111.com>">
<meta name="copyright" content="viral32111 <contact@viral32111.com>">
Expand All @@ -24,7 +24,7 @@
<meta name="og:site_name" content="OAuth Demo">
<meta name="og:title" content="Get Started">
<meta name="og:description" content="Demonstration of OAuth 2.0 integration with various providers.">
<meta name="og:locale" content="en_gb">
<meta name="og:locale" content="en-gb">

<!-- Search engine crawling -->
<meta name="robots" content="noarchive,noimageindex">
Expand All @@ -46,10 +46,9 @@ <h1>OAuth Demo</h1>
<h2>Get Started</h2>
<p>You are <strong>not</strong> signed in yet, so begin by signing in with your favourite provider below.</p>
<p>You will be sent to their website & prompted to grant access your account's information.</p>
<p class="tip">Tip: Hover over a provider to see what user information this website is requesting.</p>
<ul>
<li><a href="/functions/sign-in/discord" title="User identifier, username, discriminator, email address, avatar.">Discord</a></li>
<li><a href="/functions/sign-in/google" title="Account identifier, name, email address, profile picture.">Google</a></li>
<li><a href="/functions/sign-in/discord">Discord</a></li>
<li><a href="/functions/sign-in/google">Google</a></li>
<li><a href="/functions/sign-in/microsoft">Microsoft</a></li>
<li><a href="/functions/sign-in/apple">Apple</a></li>
<li><a href="/functions/sign-in/twitter">Twitter</a></li>
Expand All @@ -70,7 +69,7 @@ <h2>Get Started</h2>
</footer>

<!-- Include jQuery & our own scripts -->
<script src="https://code.jquery.com/jquery-3.6.3.min.js" type="text/javascript" integrity="sha384-Ft/vb48LwsAEtgltj7o+6vtS2esTU9PCpDqcXs4OCVQFZu5BqprHtUCZ4kjK+bpE" crossorigin="anonymous"></script>
<script src="/scripts/example.js" type="text/javascript"></script>
<script src="https://code.jquery.com/jquery-3.7.0.min.js" integrity="sha384-NXgwF8Kv9SSAr+jemKKcbvQsz+teULH/a5UNJvZc6kP47hZgl62M1vGnw6gHQhb1" crossorigin="anonymous"></script>
<script src="/scripts/example.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion functions/hello.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export function onRequest() {
return new Response( "Hello world!" )
return new Response( "Hello World!" )
}
Loading

0 comments on commit fdae586

Please sign in to comment.