Automate Action Release

Utilizing build & tag action to automate the deps and build steps for releasing the Action. Additionally using NCC for the build process to easy compile the deps into a small executable with the JS file.
This commit is contained in:
Jacob M-G Evans 2023-08-08 13:03:11 -05:00
parent 20ea506049
commit d6590f86f4
No known key found for this signature in database
GPG key ID: 2A0C497CAB123094
10 changed files with 58 additions and 30 deletions

View file

@ -20,8 +20,8 @@ jobs:
node-version: "latest" node-version: "latest"
cache: "npm" cache: "npm"
- name: Install Dependencies - name: Install modules and build
run: npm install run: npm ci && npm run build
- name: Unit Tests - name: Unit Tests
run: npm run test run: npm run test
@ -29,9 +29,6 @@ jobs:
- name: Check Formatting - name: Check Formatting
run: npm run check run: npm run check
- name: Build Action
run: npm run build
- name: Only build app - name: Only build app
uses: ./ uses: ./
with: with:

27
.github/workflows/publish.yml vendored Normal file
View file

@ -0,0 +1,27 @@
name: Publish
on:
release:
types: [published, edited]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.release.tag_name }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "latest"
cache: "npm"
- name: Install modules and build
run: npm ci && npm run build
- uses: JasonEtco/build-and-tag-action@v2
env:
GITHUB_TOKEN: ${{ github.token }}

3
.gitignore vendored
View file

@ -1,3 +1,4 @@
dist
.idea .idea
.vscode .vscode
@ -31,7 +32,7 @@ Temporary Items
.apdisk .apdisk
### Node ### ### Node ###
node_modules
# Logs # Logs
logs logs
*.log *.log

11
node_modules/.package-lock.json generated vendored
View file

@ -1,6 +1,6 @@
{ {
"name": "wrangler-action", "name": "wrangler-action",
"version": "4.0.0", "version": "3.0.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
@ -521,6 +521,15 @@
"integrity": "sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==", "integrity": "sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==",
"dev": true "dev": true
}, },
"node_modules/@vercel/ncc": {
"version": "0.36.1",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.36.1.tgz",
"integrity": "sha512-S4cL7Taa9yb5qbv+6wLgiKVZ03Qfkc4jGRuiUQMQ8HGBD5pcNRnHeYM33zBvJE4/zJGjJJ8GScB+WmTsn9mORw==",
"dev": true,
"bin": {
"ncc": "dist/ncc/cli.js"
}
},
"node_modules/@vitest/expect": { "node_modules/@vitest/expect": {
"version": "0.33.0", "version": "0.33.0",
"resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.33.0.tgz", "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.33.0.tgz",

14
package-lock.json generated
View file

@ -1,12 +1,12 @@
{ {
"name": "wrangler-action", "name": "wrangler-action",
"version": "4.0.0", "version": "3.0.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "wrangler-action", "name": "wrangler-action",
"version": "4.0.0", "version": "3.0.0",
"license": "MIT OR Apache-2.0", "license": "MIT OR Apache-2.0",
"dependencies": { "dependencies": {
"@actions/core": "^1.10.0" "@actions/core": "^1.10.0"
@ -15,6 +15,7 @@
"@changesets/cli": "^2.26.2", "@changesets/cli": "^2.26.2",
"@cloudflare/workers-types": "^4.20230710.1", "@cloudflare/workers-types": "^4.20230710.1",
"@types/node": "^20.4.2", "@types/node": "^20.4.2",
"@vercel/ncc": "^0.36.1",
"prettier": "^3.0.0", "prettier": "^3.0.0",
"typescript": "^5.1.6", "typescript": "^5.1.6",
"vitest": "^0.33.0" "vitest": "^0.33.0"
@ -873,6 +874,15 @@
"integrity": "sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==", "integrity": "sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==",
"dev": true "dev": true
}, },
"node_modules/@vercel/ncc": {
"version": "0.36.1",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.36.1.tgz",
"integrity": "sha512-S4cL7Taa9yb5qbv+6wLgiKVZ03Qfkc4jGRuiUQMQ8HGBD5pcNRnHeYM33zBvJE4/zJGjJJ8GScB+WmTsn9mORw==",
"dev": true,
"bin": {
"ncc": "dist/ncc/cli.js"
}
},
"node_modules/@vitest/expect": { "node_modules/@vitest/expect": {
"version": "0.33.0", "version": "0.33.0",
"resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.33.0.tgz", "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.33.0.tgz",

View file

@ -23,7 +23,8 @@
"type": "module", "type": "module",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
"build": "tsc", "start": "npx ncc run ./src/index.ts",
"build": "npx ncc build ./src/index.ts",
"test": "vitest", "test": "vitest",
"format": "prettier --write . --ignore-path ./dist/**", "format": "prettier --write . --ignore-path ./dist/**",
"check": "prettier --check . --ignore-path ./dist/**" "check": "prettier --check . --ignore-path ./dist/**"
@ -32,11 +33,12 @@
"@actions/core": "^1.10.0" "@actions/core": "^1.10.0"
}, },
"devDependencies": { "devDependencies": {
"@changesets/cli": "^2.26.2",
"@cloudflare/workers-types": "^4.20230710.1", "@cloudflare/workers-types": "^4.20230710.1",
"@types/node": "^20.4.2", "@types/node": "^20.4.2",
"@vercel/ncc": "^0.36.1",
"prettier": "^3.0.0", "prettier": "^3.0.0",
"typescript": "^5.1.6", "typescript": "^5.1.6",
"vitest": "^0.33.0", "vitest": "^0.33.0"
"@changesets/cli": "^2.26.2"
} }
} }

View file

@ -1,4 +0,0 @@
<h1>My Static Site Test</h1>
<p>To Test Secrets go to /secret</p>
<a href="/secret">Secrets</a>
<footer>a footer</footer>

View file

@ -2,10 +2,3 @@ name = "wrangler-action-test"
main = "./index.ts" main = "./index.ts"
compatibility_date = "2023-07-07" compatibility_date = "2023-07-07"
workers_dev = true workers_dev = true
[site]
bucket = "./public"
# [vars]
# SECRET1 = "value1"
# SECRET2 = "value2"

View file

@ -1,4 +0,0 @@
<h1>My Static Site Test</h1>
<p>To Test Secrets go to /secret</p>
<a href="/secret">Secrets</a>
<footer>a footer</footer>

View file

@ -3,9 +3,6 @@ main = "./index.ts"
compatibility_date = "2023-07-07" compatibility_date = "2023-07-07"
workers_dev = true workers_dev = true
[site]
bucket = "./public"
[env.dev] [env.dev]
name = "wrangler-action-dev-environment-test" name = "wrangler-action-dev-environment-test"
[env.dev.vars] [env.dev.vars]