Automatically publish to self NPM repository

This commit is contained in:
Nemo 2022-03-31 13:15:33 +05:30
parent 001ebeff46
commit 1bb9925110
5 changed files with 21 additions and 7 deletions

View File

@ -1,5 +1,4 @@
on: on:
push:
schedule: schedule:
- cron: '0 18 * * *' - cron: '0 18 * * *'
name: Update name: Update
@ -7,13 +6,15 @@ jobs:
update: update:
name: Update name: Update
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
ref: ${{ github.head_ref }} ref: ${{ github.head_ref }}
- name: Update data - name: Update data
id: update run: php update.php
run: make all
- name: Get current date - name: Get current date
uses: josStorer/get-current-time@v2 uses: josStorer/get-current-time@v2
id: current-time id: current-time
@ -27,9 +28,16 @@ jobs:
commit_author: actions-user <65916846+actions-user@users.noreply.github.com> commit_author: actions-user <65916846+actions-user@users.noreply.github.com>
file_pattern: hashes/*.json lookup/*.json file_pattern: hashes/*.json lookup/*.json
status_options: '--untracked-files=no' 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: | run: |
npm test
npm version "v${{ steps.current-time.outputs.formattedTime }}" npm version "v${{ steps.current-time.outputs.formattedTime }}"
git push origin --tags git push origin --tags
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ steps.commit.output.changes_detected}} if: ${{ steps.commit.output.changes_detected}}
# TODO: NPM Publish

View File

@ -40,3 +40,8 @@ The schema for these files is fairly intuitive:
"sha1_hash": ["list", "of", "versions"] "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.

View File

@ -1,2 +0,0 @@
all:
php update.php

View File

@ -20,6 +20,9 @@
"bugs": { "bugs": {
"url": "https://github.com/captn3m0/electron-fingerprints/issues" "url": "https://github.com/captn3m0/electron-fingerprints/issues"
}, },
"publishConfig": {
"registry": "https://npm.pkg.github.com"
},
"homepage": "https://github.com/captn3m0/electron-fingerprints#readme", "homepage": "https://github.com/captn3m0/electron-fingerprints#readme",
"devDependencies": { "devDependencies": {
"semver": "^7.3.5" "semver": "^7.3.5"