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"
cache: "npm"
- name: Install Dependencies
run: npm install
- name: Install modules and build
run: npm ci && npm run build
- name: Unit Tests
run: npm run test
@ -29,9 +29,6 @@ jobs:
- name: Check Formatting
run: npm run check
- name: Build Action
run: npm run build
- name: Only build app
uses: ./
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
.vscode
@ -31,7 +32,7 @@ Temporary Items
.apdisk
### Node ###
node_modules
# Logs
logs
*.log

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

@ -1,6 +1,6 @@
{
"name": "wrangler-action",
"version": "4.0.0",
"version": "3.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
@ -521,6 +521,15 @@
"integrity": "sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==",
"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": {
"version": "0.33.0",
"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",
"version": "4.0.0",
"version": "3.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "wrangler-action",
"version": "4.0.0",
"version": "3.0.0",
"license": "MIT OR Apache-2.0",
"dependencies": {
"@actions/core": "^1.10.0"
@ -15,6 +15,7 @@
"@changesets/cli": "^2.26.2",
"@cloudflare/workers-types": "^4.20230710.1",
"@types/node": "^20.4.2",
"@vercel/ncc": "^0.36.1",
"prettier": "^3.0.0",
"typescript": "^5.1.6",
"vitest": "^0.33.0"
@ -873,6 +874,15 @@
"integrity": "sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==",
"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": {
"version": "0.33.0",
"resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.33.0.tgz",

View file

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

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"
compatibility_date = "2023-07-07"
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"
workers_dev = true
[site]
bucket = "./public"
[env.dev]
name = "wrangler-action-dev-environment-test"
[env.dev.vars]