Skip to content

Commit

Permalink
chore: Restructure the repo (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianGonz97 authored Jan 8, 2024
1 parent 6295411 commit 3002397
Show file tree
Hide file tree
Showing 27 changed files with 6,993 additions and 4,226 deletions.
10 changes: 0 additions & 10 deletions .editorconfig

This file was deleted.

10 changes: 10 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules
dist

pnpm-lock.yaml
.changeset
.prettierrc
package.json

vite.config.js.timestamp-*
vite.config.ts.timestamp-*
7 changes: 7 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* eslint-env node */
module.exports = {
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
root: true,
};
2 changes: 0 additions & 2 deletions .git-blame-ignore-revs

This file was deleted.

1 change: 0 additions & 1 deletion .github/CODEOWNERS

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
accountId: 468cce80dfb431f3a4058e6dc6031a44
projectName: github-actions-example
directory: example
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
id: publish
- name: Outputs
run: |
Expand Down
104 changes: 0 additions & 104 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,41 +1,8 @@

# Created by https://www.toptal.com/developers/gitignore/api/node,macos
# Edit at https://www.toptal.com/developers/gitignore?templates=node,macos

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud

### Node ###
# Logs
logs
*.log
Expand Down Expand Up @@ -92,18 +59,6 @@ web_modules/
# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

Expand All @@ -117,62 +72,3 @@ web_modules/
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

### Node Patch ###
# Serverless Webpack directories
.webpack/

# Optional stylelint cache

# SvelteKit build / generate output
.svelte-kit

# End of https://www.toptal.com/developers/gitignore/api/node,macos
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm run build && git add index.js
pnpm run build && git add dist/index.js
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
.husky
pnpm-lock.yaml
8 changes: 4 additions & 4 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"printWidth": 120,
"singleQuote": false,
"semi": true,
"useTabs": true
"useTabs": true,
"singleQuote": true,
"trailingComma": "es5",
"printWidth": 100
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Cloudflare
Copyright (c) 2023 AdrianGonz97, Cloudflare

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
38 changes: 20 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
> This is an opinionated fork of the official pages action: https://github.com/cloudflare/pages-action
# Cloudflare Pages GitHub Action

GitHub Action for creating Cloudflare Pages deployments, using the new [Direct Upload](https://developers.cloudflare.com/pages/platform/direct-upload/) feature and [Wrangler](https://developers.cloudflare.com/pages/platform/direct-upload/#wrangler-cli) integration.
GitHub Action for creating Cloudflare Pages deployments, using the [Direct Upload](https://developers.cloudflare.com/pages/platform/direct-upload/) feature with [Wrangler](https://developers.cloudflare.com/pages/platform/direct-upload/#wrangler-cli).

## Usage

Expand Down Expand Up @@ -32,7 +34,7 @@ GitHub Action for creating Cloudflare Pages deployments, using the new [Direct U
projectName: YOUR_PROJECT_NAME
directory: YOUR_BUILD_OUTPUT_DIRECTORY
# Optional: Enable this if you want to have GitHub Deployments triggered
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
# Optional: Switch what branch you are publishing to.
# By default this will be the branch which triggered this workflow
branch: main
Expand All @@ -55,14 +57,14 @@ If you do not have a zone registered to your account, you can also get your acco
To generate an API token:

1. Log in to the Cloudflare dashboard.
2. Select My Profile from the dropdown menu of your user icon on the top right of your dashboard.
3. Select API Tokens > Create Token.
4. Under Custom Token, select Get started.
5. Name your API Token in the Token name field.
6. Under Permissions, select Account, Cloudflare Pages and Edit:
7. Select Continue to summary > Create Token.
1. Select My Profile from the dropdown menu of your user icon on the top right of your dashboard.
1. Select API Tokens > Create Token.
1. Under Custom Token, select Get started.
1. Name your API Token in the Token name field.
1. Under Permissions, select Account, Cloudflare Pages and Edit:
1. Select Continue to summary > Create Token.

More information can be found on [our guide for making Direct Upload deployments with continous integration](https://developers.cloudflare.com/pages/how-to/use-direct-upload-with-continuous-integration/#use-github-actions).
More information can be found on [our guide for making Direct Upload deployments with continuous integration](https://developers.cloudflare.com/pages/how-to/use-direct-upload-with-continuous-integration/#use-github-actions).

### Specifying a branch

Expand All @@ -81,15 +83,15 @@ By default Wrangler will run in the root package directory. If your app lives in
You can use the newly released [Wrangler v3](https://blog.cloudflare.com/wrangler3/) with the `wranglerVersion` property.

```yaml
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: YOUR_ACCOUNT_ID
projectName: YOUR_PROJECT_NAME
directory: YOUR_BUILD_OUTPUT_DIRECTORY
# Enable Wrangler v3
wranglerVersion: '3'
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: YOUR_ACCOUNT_ID
projectName: YOUR_PROJECT_NAME
directory: YOUR_BUILD_OUTPUT_DIRECTORY
# Enable Wrangler v3
wranglerVersion: '3'
```

## Outputs
Expand Down
35 changes: 16 additions & 19 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,34 @@
name: "Cloudflare Pages GitHub Action"
description: "Publish to Cloudflare Pages"
branding:
icon: "upload-cloud"
color: "orange"
name: 'Cloudflare Pages GitHub Action'
description: 'Publish to Cloudflare Pages with PR previews'
inputs:
apiToken:
description: "Cloudflare API Token"
description: 'Cloudflare API Token'
required: true
accountId:
description: "Cloudflare Account ID"
description: 'Cloudflare Account ID'
required: true
projectName:
description: "The name of the Pages project to upload to"
description: 'The name of the Pages project to upload to'
required: true
directory:
description: "The directory of static assets to upload"
description: 'The directory of static assets to upload'
required: true
githubToken:
description: 'GitHub Token'
required: true
gitHubToken:
description: "GitHub Token"
required: false
branch:
description: "The name of the branch you want to deploy to"
description: 'The name of the branch you want to deploy to'
required: false
deploymentName:
description: "The name of the GitHub deployment"
description: 'The name of the GitHub deployment'
required: false
workingDirectory:
description: "The working directory in which to run Wrangler"
description: 'The working directory in which to run Wrangler'
required: false
wranglerVersion:
description: "The version of Wrangler to use"
description: 'The version of Wrangler to use'
required: false
default: "3"
default: '3'
runs:
using: "node16"
main: "index.js"
using: 'node16'
main: 'dist/index.js'
Loading

0 comments on commit 3002397

Please sign in to comment.