From 1bb9925110aa3447c44afbc61ab6b3c011862435 Mon Sep 17 00:00:00 2001 From: Nemo Date: Thu, 31 Mar 2022 13:15:33 +0530 Subject: [PATCH] Automatically publish to self NPM repository --- .github/workflows/{action.yml => test.yml} | 0 .github/workflows/{update.yaml => update.yml} | 18 +++++++++++++----- HACKING.md | 5 +++++ Makefile | 2 -- package.json | 3 +++ 5 files changed, 21 insertions(+), 7 deletions(-) rename .github/workflows/{action.yml => test.yml} (100%) rename .github/workflows/{update.yaml => update.yml} (72%) delete mode 100644 Makefile diff --git a/.github/workflows/action.yml b/.github/workflows/test.yml similarity index 100% rename from .github/workflows/action.yml rename to .github/workflows/test.yml diff --git a/.github/workflows/update.yaml b/.github/workflows/update.yml similarity index 72% rename from .github/workflows/update.yaml rename to .github/workflows/update.yml index a11f5a8..208e0bb 100644 --- a/.github/workflows/update.yaml +++ b/.github/workflows/update.yml @@ -1,5 +1,4 @@ on: - push: schedule: - cron: '0 18 * * *' name: Update @@ -7,13 +6,15 @@ jobs: update: name: Update runs-on: ubuntu-latest + permissions: + contents: read + packages: write steps: - uses: actions/checkout@v3 with: ref: ${{ github.head_ref }} - name: Update data - id: update - run: make all + run: php update.php - name: Get current date uses: josStorer/get-current-time@v2 id: current-time @@ -27,9 +28,16 @@ jobs: commit_author: actions-user <65916846+actions-user@users.noreply.github.com> file_pattern: hashes/*.json lookup/*.json status_options: '--untracked-files=no' - - name: NPM Version Bump + - uses: actions/setup-node@v2 + with: + node-version: '16' + registry-url: 'https://npm.pkg.github.com' + - name: NPM Publish run: | + npm test npm version "v${{ steps.current-time.outputs.formattedTime }}" git push origin --tags + npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} if: ${{ steps.commit.output.changes_detected}} - # TODO: NPM Publish diff --git a/HACKING.md b/HACKING.md index 7e8fcde..77b21c1 100644 --- a/HACKING.md +++ b/HACKING.md @@ -40,3 +40,8 @@ The schema for these files is fairly intuitive: "sha1_hash": ["list", "of", "versions"] } ``` + +## GitHub Actions + +1. Tests are run on all supported Node versions +2. Hashes are automatically updated daily, and a new release is triggered in case of new electron releases. diff --git a/Makefile b/Makefile deleted file mode 100644 index dd3906c..0000000 --- a/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -all: - php update.php diff --git a/package.json b/package.json index bb48fd0..9d9c82a 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,9 @@ "bugs": { "url": "https://github.com/captn3m0/electron-fingerprints/issues" }, + "publishConfig": { + "registry": "https://npm.pkg.github.com" + }, "homepage": "https://github.com/captn3m0/electron-fingerprints#readme", "devDependencies": { "semver": "^7.3.5"