Skip to content

Commit

Permalink
Merge pull request #13 from Bandwidth/fix-workflow-again
Browse files Browse the repository at this point in the history
Update release_publish.yml
  • Loading branch information
jmulford-bw authored Mar 23, 2021
2 parents 607dbf0 + 8e25b21 commit 8e76d79
Showing 1 changed file with 24 additions and 27 deletions.
51 changes: 24 additions & 27 deletions .github/workflows/release_publish.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@
name: Publish Release

name: Deploy
on:
release:
types:
- published

jobs:
publish-npm:
if: ${{ !github.event.release.prerelease && github.event.release.target_commitish == 'main' }}
deploy:
name: Deploy
runs-on: ubuntu-latest
if: ${{ !github.event.release.prerelease && github.event.release.target_commitish == 'main' }}
steps:
- uses: actions/checkout@v1
- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: '14'
check-latest: true
- name: npm install
run: npm install
- name: npm version and publish
run: |
export MAJOR_MINOR_SEMVER=${GITHUB_REF:10}
echo "MAJOR_MINOR_SEMVER=${MAJOR_MINOR_SEMVER}"
git config user.name $GITHUB_ACTOR
git config user.email gh-actions-${GITHUB_ACTOR}@github.com
git remote add gh-origin https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
npm version ${MAJOR_MINOR_SEMVER} --force -m "Bump version to %s"
git push gh-origin HEAD:main --tags
echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" >> ~/.npmrc
npm publish --access public
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: Checkout
uses: actions/checkout@v2
- name: Set release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '12.x'
registry-url: 'https://registry.npmjs.org'
- name: Build and test npm package
run: |
npm install
npm run build
npm run test --if-present
- name: Publish npm package
run: |
npm version $RELEASE_VERSION --no-git-tag-version
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

0 comments on commit 8e76d79

Please sign in to comment.