-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Update GitHub Actions workflow for releasing and publishing pa…
…ckage
- Loading branch information
Showing
1 changed file
with
22 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,46 @@ | ||
name: Release and Publish Package | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20' | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Build | ||
run: npm run build | ||
- name: Bump version and create a git tag | ||
|
||
- name: Bump version, create tag, and push changes | ||
id: bump_version | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
npm version patch -m "Bump version to %s [skip ci]" | ||
echo ::set-output name=VERSION::$(node -p "require('./package.json').version") | ||
- name: Push changes | ||
run: | | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
git remote set-url origin https://${{ secrets.GH_PAT }}@github.com/holly-sheets/holly-sheets.git | ||
git push --follow-tags | ||
env: | ||
GH_PAT: ${{ secrets.GH_PAT }} | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
npm version patch -m "Bump version to %s [skip ci]" | ||
git push --follow-tags | ||
echo VERSION=$(node -p "require('./package.json').version") >> $GITHUB_ENV | ||
- name: Create GitHub Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
tag_name: ${{ steps.bump_version.outputs.VERSION }} | ||
release_name: Release ${{ steps.bump_version.outputs.VERSION }} | ||
draft: false | ||
prerelease: false | ||
tag: ${{ env.VERSION }} | ||
name: Release ${{ env.VERSION }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Publish to npm | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN }} | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |