From 3c70e3f76052a3bfc9bd2c4a956d91d687614bd8 Mon Sep 17 00:00:00 2001 From: Dusty Greif Date: Thu, 29 Sep 2022 13:59:53 -0700 Subject: [PATCH] Fix releases (#70) * Remove release action in favor of publish * Also publish to GHPR --- .github/workflows/release.yml | 85 ----------------------------------- package.json | 3 +- 2 files changed, 2 insertions(+), 86 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 5a721a3..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,85 +0,0 @@ -name: Release and publish - -# Inspired by https://github.com/MylesBorins/node-osc/blob/959b9c83972a67390a351d333b23db3972ca7b46/.github/workflows/bump-version.yml and -# https://github.com/MylesBorins/node-osc/blob/74b563c83736a04c4a37acbff9d7bb1f01a00f57/.github/workflows/create-release.yml - -on: - workflow_dispatch: - inputs: - version: - description: Semver descriptor for new version ("major", "minor", or "patch") - required: true - -jobs: - bump-version: - name: Bump package version - runs-on: ubuntu-latest - outputs: - new-tag: ${{ steps.new-tag.outputs.new-tag }} - steps: - - name: Checkout ref - uses: actions/checkout@v2 - - name: Preparation - uses: ./.github/actions/setup - - name: Perform last-minute tests - run: npm test - - name: Configure Git - run: | - git config user.name "GitHub Actions" - git config user.email "actions@github.com" - - name: Bump package version - run: npm version ${{ github.event.inputs.version }} - - name: Push back to GitHub - run: git push origin main --follow-tags - - name: Set output to new version - id: new-tag - run: | - version=$(jq -r .version < package.json) - echo "::set-output name=new-tag::v$version" - create-release: - name: Create GitHub release - runs-on: ubuntu-latest - needs: bump-version - steps: - - name: Checkout ref - uses: actions/checkout@v2 - with: - ref: ${{ needs.bump-version.outputs.new-tag }} - - name: Preparation - uses: ./.github/actions/setup - - name: Create release - uses: actions/github-script@v5 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - await github.request(`POST /repos/${{ github.repository }}/releases`, { - tag_name: "${{ needs.bump-version.outputs.new-tag }}", - generate_release_notes: true - }) - publish: - name: Publish - runs-on: ubuntu-latest - needs: [bump-version, create-release] - steps: - - name: Checkout ref - uses: actions/checkout@v2 - with: - ref: ${{ needs.bump-version.outputs.new-tag }} - - name: Preparation - uses: ./.github/actions/setup - - name: Setup npm registry - uses: actions/setup-node@v2 - with: - registry-url: 'https://registry.npmjs.org' - - name: Publish to npm - run: npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Setup GHPR - uses: actions/setup-node@v2 - with: - registry-url: 'https://npm.pkg.github.com' - - name: Publish to GHPR - run: npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index 5945be3..c91b493 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "build": "rollup -c", "pretest": "npm run build", "test": "karma start karma.config.js", - "prepublishOnly": "npm run build" + "prepublishOnly": "npm run build", + "postpublish": "npm publish --ignore-scripts --@github:registry='https://npm.pkg.github.com'" }, "keywords": [ "clipboard",