1
0
mirror of synced 2024-11-28 07:36:03 +03:00

Enable GPM (#5660)

* Uncomment the deploy_github job for GPR

* Automatically add private scope to package for GPM

This is requires in order to deploy to GitHub package manager since
all packages must be scoped to the organization that they are being
deployed to. Because of how publishing scoped packages works with
NPM, there is no easier way to rename a package that is being pushed
to both a scoped and unscoped registry.

* Don't run NPM deploy if it's not a release

There was a change last week that now allows jobs to be filtered
entirely, so this now works like we had originally hoped.

* Tag branch pushes with commit

This is needed because you cannot overwrite a version on NPM, so the
previous plan of just using the prelease version would only work for
a single commit.

* Fixed invalid version identifier
This commit is contained in:
Kevin Brown 2019-10-09 23:25:12 -04:00 committed by GitHub
parent 7c4131bc27
commit 7c67f3e9b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,35 +8,37 @@ on:
release: ~ release: ~
jobs: jobs:
# deploy_github: deploy_github:
# name: GitHub Package Registry name: GitHub Package Registry
# runs-on: ubuntu-latest runs-on: ubuntu-latest
# steps: steps:
# - uses: actions/checkout@v1 - uses: actions/checkout@v1
# - name: Use Node.js 8 - name: Use Node.js 8
# uses: actions/setup-node@v1 uses: actions/setup-node@v1
# with: with:
# node-version: 8 node-version: 8
# registry-url: https://npm.pkg.github.com/ registry-url: https://npm.pkg.github.com/
# scope: '@select2' scope: '@select2'
# - name: npm install - name: Rename package to include private scope
# run: npm install run: "sed -i -e 's#\"name\": \"select2\"#\"name\": \"@select2/select2\"#' package.json"
# - name: Run linting, tests, minify - name: npm install
# run: grunt run: npm install
# - name: Deploy (release) - name: Run linting, tests, minify
# if: github.event_name == 'release' run: grunt
# run: npm publish - name: Deploy (release)
# env: if: github.event_name == 'release'
# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} run: npm publish
# - name: Deploy (release candidate) env:
# if: github.event_name == 'push' NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
# run: | - name: Deploy (release candidate)
# npm --no-git-tag-version version prerelease if: github.event_name == 'push'
# npm publish --tag next run: 'sed -i -E "s/\"version\": \"(.+)\",/\"version\": \"\1-commit-$GITHUB_SHA\",/" package.json && npm publish --tag next'
# env: env:
# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
GITHUB_SHA: ${{github.sha}}
deploy_npm: deploy_npm:
name: NPM name: NPM
if: github.event_name == 'release'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
@ -51,7 +53,6 @@ jobs:
- name: Run linting, tests, minify - name: Run linting, tests, minify
run: grunt run: grunt
- name: Deploy (release) - name: Deploy (release)
if: github.event_name == 'release'
run: npm publish run: npm publish
env: env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}