Skip to content

Commit

Permalink
Merge pull request #40 from Dirt-Road-Development/bug/fix-publish-3
Browse files Browse the repository at this point in the history
bug:fix-publish-3
  • Loading branch information
TheGreatAxios authored Nov 30, 2022
2 parents e3a31cf + 69ae2b4 commit f0eaef5
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 18 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish Packages
on: [pull_request]
jobs:
publish:
runs-on: ubuntu-latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
fetch-depth: "0"
token: ${{ secrets.GITHUB_TOKEN }} # this token is available by default
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'

- name: Conifrm NPM Publishability
run: npm whoami # will throw and exit if npm is not ready to publish

- name: Install dependencies
run: npm ci

- name: Link Dependencies
run: npx lerna link

- name: Build Packages
run: npm run build

- name: Configure Git User
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor}}@users.noreply.github.com"
- name: Prerelease Tag
run: npm run version:prerelease

- name: Publish
run: |
npm run publish
33 changes: 15 additions & 18 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,21 @@ on:
- development
- beta
- stable

jobs:
publish:
if: github.event.pull_request.merged
runs-on: ubuntu-latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

strategy:
matrix:
node-version: [16.x]

steps:

- uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
fetch-depth: "0"
token: ${{ secrets.GITHUB_TOKEN }} # this token is available by default

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
Expand All @@ -45,7 +40,7 @@ jobs:
- name: Build Packages
run: npm run build

- name: "Configure Git User"
- name: Configure Git User
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand All @@ -57,17 +52,19 @@ jobs:
export BRANCH=${GITHUB_REF##*/}
echo "Branch: $BRANCH"
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
- name: "Version"
run: |
if [[ "$BRANCH" == "main" ]]; then
npm run version:major
else if [[ "$BRANCH" == "beta" ]]; then
npm run version:minor
else if [[ "$BRANCH" == "development" ]]; then
npm run version:patch
else
npm run version:prerelease
fi
- name: "Publish"
- name: 'Major Version'
if: github.ref_name == 'main'
run: npm run version:major

- name: 'Minor Version'
if: github.ref_name == 'beta'
run: npm run version:minor

- name: Bump Version
if: github.ref_name == 'development'
run: npm run version:patch

- name: Publish
run: |
npm run publish

0 comments on commit f0eaef5

Please sign in to comment.