From 8d792fdb2c7a482607c8885c1cc2b368a1c8a1e6 Mon Sep 17 00:00:00 2001 From: d10sfan Date: Wed, 7 Feb 2024 14:34:57 -0600 Subject: [PATCH] Update to use github actions & bot --- .github/FUNDING.yml | 3 +++ .github/dependabot.yml | 10 ++++++++++ .github/workflows/deploy.yml | 29 +++++++++++++++++++++++++++++ .github/workflows/test.yml | 17 +++++++++++++++++ README.md | 3 +-- package-lock.json | 25 ++++++++++--------------- package.json | 6 ++---- 7 files changed, 72 insertions(+), 21 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..a5f672d --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,29 @@ +name: Build Action +on: + push: + branches: [master] +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: master 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..08075b0 100644 --- a/README.md +++ b/README.md @@ -5,5 +5,4 @@ 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 35c9305..571bf1a 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": "^5.1.1" - }, - "devDependencies": { - "@zeit/ncc": "^0.22.3" + "@actions/github": "^5.1.1", + "@vercel/ncc": "^0.38.1" } }, "node_modules/@actions/core": { @@ -144,12 +142,10 @@ "@octokit/openapi-types": "^12.11.0" } }, - "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" } @@ -369,11 +365,10 @@ "@octokit/openapi-types": "^12.11.0" } }, - "@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==" }, "before-after-hook": { "version": "2.2.3", diff --git a/package.json b/package.json index 0661b4a..d2c0fb4 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": "^5.1.1" - }, - "devDependencies": { - "@zeit/ncc": "^0.22.3" + "@actions/github": "^5.1.1", + "@vercel/ncc": "^0.38.1" } }