From 90e91751e884d9e7a34ecdeaf2222fce1a11d319 Mon Sep 17 00:00:00 2001 From: Albert Martin Date: Fri, 20 Dec 2024 18:02:06 +0000 Subject: [PATCH] ci: add publish workflow --- .github/workflows/publish.yml | 44 +++++++++++++++++++++++++++++++++++ .npmignore | 15 ++++++++---- package.json | 3 ++- 3 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..582e8f7 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,44 @@ +name: Publish + +on: + workflow_dispatch: + inputs: + version: + required: true + type: choice + options: + - prerelease + - patch + - minor + - major + +jobs: + npm: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.GH_TOKEN }} + - uses: actions/setup-node@v4 + with: + cache: npm + node-version-file: .nvmrc + registry-url: https://npm.pkg.github.com/ + scope: '@mapquest' + - name: Run git config + run: | + git config user.name GitHub + git config user.email github-action@users.noreply.github.com + - run: npm version ${{ github.event.inputs.version }} + - run: git push origin main --follow-tags + - run: npm ci + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Run npm publish + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.npmignore b/.npmignore index 8407030..c2e2187 100644 --- a/.npmignore +++ b/.npmignore @@ -1,11 +1,18 @@ *.swp -node_modules -npm-debug.log +*.spec.* +.devcontainer/ +.eslint* .git* -parse.py -data.csv +.nvmrc +benchmark/ +coverage/ codes.csv functions.js +data.csv data.js +jest.config.js Makefile +node_modules +npm-debug.log +parse.py test diff --git a/package.json b/package.json index 66149c1..1ed70d7 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "main": "./iso3166.min.js", "scripts": { "benchmark": "node ./benchmark/index.js", - "test": "jest ." + "test": "jest .", + "prepublish": "make" }, "devDependencies": { "@mapquest/team": "^0.3.8",