Skip to content

Commit

Permalink
STAT-12: Update workflow to use timestamp for dev release.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereckmezquita committed Sep 3, 2024
1 parent df614de commit 4fc2e91
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions .github/workflows/npm_publish_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches-ignore:
- 'master'

jobs:
build-and-publish-dev:
runs-on: ubuntu-latest
Expand All @@ -13,12 +14,28 @@ jobs:
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: yarn install --frozen-lockfile
- run: yarn test
- run: |
while true; do
npm version prerelease --preid=dev --no-git-tag-version
npm publish --tag dev && break
done

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Run tests
run: yarn test

- name: Get current version
id: package-version
uses: martinbeentjes/[email protected]

- name: Generate unique version
id: generate-version
run: |
current_version=$(echo ${{ steps.package-version.outputs.current-version}} | sed 's/-dev\.[0-9]\+$//')
timestamp=$(date +%Y%m%d%H%M%S)
echo "new_version=${current_version}-dev.${timestamp}" >> $GITHUB_OUTPUT
- name: Update version
run: npm version ${{ steps.generate-version.outputs.new_version }} --no-git-tag-version

- name: Publish to npm
run: npm publish --tag dev
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

0 comments on commit 4fc2e91

Please sign in to comment.