Skip to content

Commit

Permalink
Update workflow files to use yarn install
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisli30 committed Nov 28, 2023
1 parent 707d223 commit 96b6637
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
24 changes: 9 additions & 15 deletions .github/workflows/npm-publish-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,27 @@ jobs:
- name: 🤘 checkout
uses: actions/checkout@v3

- name: Setup Node.js environment
uses: actions/setup-node@v3.0.0
with:
node-version: 18.x
cache: 'npm'
- name: Install dependencies
run: yarn install

- name: Install Dependencies
run: npm ci --ignore-scripts

- name: 🛠️ Build
run: npm run build
- name: Run build
run: yarn build

- name: 🔐 Authenticate with NPM
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTOMATION_TOKEN_CHRIS }}" > ~/.npmrc

- name: Get the current dev version from npm
- name: Get the current dev version of packages
id: get-current-dev-version
run: |
# Get the dev tag version
tags=$(npm show @oak-network/${{ matrix.package }} dist-tags --json)
echo "Tag versions: $tags"
tags=$(yarn info @oak-network/${{ matrix.package }} dist-tags --json)
echo "Tag versions: $tags"
current_dev_version=$(echo "$tags" | jq -r '.dev')
echo "Dev tag version: $current_dev_version"
echo "current_dev_version=$current_dev_version" >> "$GITHUB_ENV"
# Get the latest version;
all_versions=$(npm show @oak-network/${{ matrix.package }} versions --json)
all_versions=$(yarn info @oak-network/${{ matrix.package }} versions --json)
echo "All versions: $all_versions"
highest_version=$(echo "$all_versions" | tr -d ' \t\n\r' | jq 'max' -r)
echo "Highest version: $highest_version"
Expand All @@ -65,7 +59,7 @@ jobs:
echo "Current Dev Version: $current_dev_version"
echo "Highest Version: $highest_version"
# Compare the new version with the current dev version and the highest version; If we publish a lower than the highest version, it will be rejected by npm.
# Compare the new version with the current dev version and the highest version; If we publish a lower than the highest version, it will be rejected by npm.js.
# TODO: I was not able to check if the new version is higher than both the current dev version and the highest version yet, so the check is very simple here. Ideally, we should check if the new version is higher.
if [ "$new_version" != "$current_dev_version" ]; then
echo "New version $new_version is different from NPM dev tag version $current_dev_version; publishing..."
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-package-tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Get dev version of ${{ matrix.package }}
id: get-version
run: |
dev_version=$(npm show @oak-network/${{ matrix.package }}@dev version)
dev_version=$(yarn info @oak-network/${{ matrix.package }}@dev version)
echo "Dev version: $dev_version"
echo "::set-output name=dev_version::$dev_version"
Expand Down

0 comments on commit 96b6637

Please sign in to comment.