From 1de527d6dbf17a8c876781d57068325d97b2d62c Mon Sep 17 00:00:00 2001 From: d10sfan Date: Wed, 7 Feb 2024 14:37:54 -0600 Subject: [PATCH] Add gh actions --- .github/FUNDING.yml | 3 +++ .github/dependabot.yml | 10 ++++++++++ .github/workflows/deploy.yml | 29 +++++++++++++++++++++++++++++ .github/workflows/test.yml | 17 +++++++++++++++++ README.md | 2 +- package-lock.json | 25 ++++++++++--------------- package.json | 6 ++---- 7 files changed, 72 insertions(+), 20 deletions(-) create mode 100644 .github/FUNDING.yml create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..ae2b63e --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +github: d10sfan diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..3deee26 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..3d69d88 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,29 @@ +name: Build Action +on: + push: + branches: [main] +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + - name: NPM Install + run: npm ci + - name: Build + run: node_modules/@vercel/ncc/dist/ncc/cli.js build index.js + - name: Commit package.json + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add -A dist + git commit -m "Update dist" + - name: Push Changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: main diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..56880b4 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,17 @@ +name: Test Action +on: + pull_request: +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + - name: NPM Install + run: npm ci + - name: Build + run: node_modules/@vercel/ncc/dist/ncc/cli.js build index.js diff --git a/README.md b/README.md index 0f2e922..6a7c924 100644 --- a/README.md +++ b/README.md @@ -5,5 +5,5 @@ GitHub Action to generate sha1 hash ## Building * Make any changes to the index.js -* Once done, run the following command `node_modules/@zeit/ncc/dist/ncc/cli.js build index.js` and create a tag +* Once committed, gh action will automatically build diff --git a/package-lock.json b/package-lock.json index b09381e..1607649 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,10 +9,8 @@ "version": "1.0.0", "dependencies": { "@actions/core": "^1.10.0", - "@actions/github": "^2.2.0" - }, - "devDependencies": { - "@zeit/ncc": "^0.22.3" + "@actions/github": "^2.2.0", + "@vercel/ncc": "^0.38.1" } }, "node_modules/@actions/core": { @@ -203,12 +201,10 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.14.tgz", "integrity": "sha512-syUgf67ZQpaJj01/tRTknkMNoBBLWJOBODF0Zm4NrXmiSuxjymFrxnTu1QVYRubhVkRcZLYZG8STTwJRdVm/WQ==" }, - "node_modules/@zeit/ncc": { - "version": "0.22.3", - "resolved": "https://registry.npmjs.org/@zeit/ncc/-/ncc-0.22.3.tgz", - "integrity": "sha512-jnCLpLXWuw/PAiJiVbLjA8WBC0IJQbFeUwF4I9M+23MvIxTxk5pD4Q8byQBSPmHQjz5aBoA7AKAElQxMpjrCLQ==", - "deprecated": "@zeit/ncc is no longer maintained. Please use @vercel/ncc instead.", - "dev": true, + "node_modules/@vercel/ncc": { + "version": "0.38.1", + "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.1.tgz", + "integrity": "sha512-IBBb+iI2NLu4VQn3Vwldyi2QwaXt5+hTyh58ggAMoCGE6DJmPvwL3KPBWcJl1m9LYPChBLE980Jw+CS4Wokqxw==", "bin": { "ncc": "dist/ncc/cli.js" } @@ -724,11 +720,10 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.14.tgz", "integrity": "sha512-syUgf67ZQpaJj01/tRTknkMNoBBLWJOBODF0Zm4NrXmiSuxjymFrxnTu1QVYRubhVkRcZLYZG8STTwJRdVm/WQ==" }, - "@zeit/ncc": { - "version": "0.22.3", - "resolved": "https://registry.npmjs.org/@zeit/ncc/-/ncc-0.22.3.tgz", - "integrity": "sha512-jnCLpLXWuw/PAiJiVbLjA8WBC0IJQbFeUwF4I9M+23MvIxTxk5pD4Q8byQBSPmHQjz5aBoA7AKAElQxMpjrCLQ==", - "dev": true + "@vercel/ncc": { + "version": "0.38.1", + "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.1.tgz", + "integrity": "sha512-IBBb+iI2NLu4VQn3Vwldyi2QwaXt5+hTyh58ggAMoCGE6DJmPvwL3KPBWcJl1m9LYPChBLE980Jw+CS4Wokqxw==" }, "atob-lite": { "version": "2.0.0", diff --git a/package.json b/package.json index 7ba892e..a0e01eb 100644 --- a/package.json +++ b/package.json @@ -14,9 +14,7 @@ "homepage": "https://github.com/luxtorpeda-dev/action-build-generate-sha1-hash#readme", "dependencies": { "@actions/core": "^1.10.0", - "@actions/github": "^2.2.0" - }, - "devDependencies": { - "@zeit/ncc": "^0.22.3" + "@actions/github": "^2.2.0", + "@vercel/ncc": "^0.38.1" } }