Skip to content
This repository has been archived by the owner on Feb 26, 2025. It is now read-only.

Commit

Permalink
chore(release): publish with dry run
Browse files Browse the repository at this point in the history
  • Loading branch information
mate-from-mattr committed Jul 9, 2024
1 parent 9374f5f commit 82e4807
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 10 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/push-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build_test_publish:
name: Build, test, and publish unstable release
if: "contains(github.event.head_commit.message, 'chore(release): publish')"
name: Build, test, and publish unstable release if master
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -26,6 +28,12 @@ jobs:
NPM_TOKEN: ${{ secrets.NPMJS_TOKEN }}
- run: git config user.name "Mattr CI"
- run: git config user.email "npmjs_ci_mattr_public@mattr.global"
- name: Set dry run status
run: |
if [[ "${{ github.event.head_commit.message }}" == *"chore(release): publish"* ]]; then
echo "NOT_DRY_RUN=1" >> $GITHUB_ENV
else
echo "NOT_DRY_RUN=0" >> $GITHUB_ENV
- run: yarn publish:unstable:ts
- name: Report Coverage
uses: codecov/codecov-action@29386c70ef20e286228c72b668a06fd0e8399192 # pin@1.5.2
Expand Down
21 changes: 19 additions & 2 deletions .github/workflows/push-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build_pub_binaries:
Expand All @@ -23,8 +26,13 @@ jobs:
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn test
- name: Set dry run status
run: |
if [[ "${{ github.event.head_commit.message }}" == *"chore(release): publish"* ]]; then
echo "NOT_DRY_RUN=1" >> $GITHUB_ENV
else
echo "NOT_DRY_RUN=0" >> $GITHUB_ENV
- name: "Publish binaries"
if: "contains(github.event.head_commit.message, 'chore(release): publish')"
run: yarn publish:binary
shell: bash
env:
Expand All @@ -41,6 +49,10 @@ jobs:
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
# see note in any-pr.yml about python 3.10.11
- uses: actions/setup-python@v4
with:
python-version: "3.10.11"
- run: yarn
- run: yarn install --frozen-lockfile
- run: yarn lint
Expand All @@ -52,6 +64,11 @@ jobs:
NPM_TOKEN: ${{ secrets.NPMJS_TOKEN }}
- run: git config user.name "Mattr CI"
- run: git config user.email "npmjs_ci_mattr_public@mattr.global"
- name: Set dry run status
run: |
if [[ "${{ github.event.head_commit.message }}" == *"chore(release): publish"* ]]; then
echo "NOT_DRY_RUN=1" >> $GITHUB_ENV
else
echo "NOT_DRY_RUN=0" >> $GITHUB_ENV
- name: "Publish package"
if: "contains(github.event.head_commit.message, 'chore(release): publish')"
run: yarn publish:ts
10 changes: 8 additions & 2 deletions scripts/publish_binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,17 @@ yarn package

# Publish the binary to github packages using strict
# so that this script can catch failures (network, auth, etc.)
node --unhandled-rejections=strict ./node_modules/.bin/node-pre-gyp-github publish --release

if [ "$NOT_DRY_RUN" -eq 1 ]; then
echo "Publishing binary..."
node --unhandled-rejections=strict ./node_modules/.bin/node-pre-gyp-github publish --release
else
echo "NOT_DRY_RUN is not set to 1, not publishing binaries"
fi

# Reset changes to the package.json
git checkout -- package.json

# Reset changes to the native folder
git checkout -- native/


10 changes: 8 additions & 2 deletions scripts/publish_ts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@ node scripts/add_stable_install_script.js
new_version=$(node -pe "require('./package.json').version")

# Version to this new unstable version
yarn publish --no-git-tag-version --new-version $new_version

if [ "$NOT_DRY_RUN" -eq 1 ]; then
echo "Publishing..."
yarn publish --no-git-tag-version --new-version $new_version
else
echo "NOT_DRY_RUN is not set to 1, not publishing"
fi
# Reset changes to the package.json
#
git checkout -- package.json


9 changes: 7 additions & 2 deletions scripts/publish_unstable_ts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ new_version=$(node -pe "require('./package.json').version")
new_unstable_version=$new_version"-unstable.$(git rev-parse --short HEAD)"

# Version to this new unstable version
yarn publish --no-git-tag-version --new-version $new_unstable_version --tag unstable
if [ "$NOT_DRY_RUN" -eq 1 ]; then
echo "Publishing unstable..."
yarn publish --no-git-tag-version --new-version $new_unstable_version --tag unstable
else
echo "NOT_DRY_RUN is not set to 1, not publishing unstable"
fi

# Reset changes to the package.json
git checkout -- package.json



0 comments on commit 82e4807

Please sign in to comment.