-
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.
Fixed multi-package issue in both npm-publish-dev and update-package-…
…tags workflows (#62) * Experiment with workflow strategy * Fixed the indention of workflow * Updated set dev to latest tag workflow with strategy * Fixed syntax of set dev to latest tag workflow * Fixed syntax of set dev to latest tag workflow
- Loading branch information
Showing
2 changed files
with
25 additions
and
40 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
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 |
---|---|---|
|
@@ -9,6 +9,12 @@ on: | |
jobs: | ||
update-tags: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
package: | ||
# List the packages to run here. The matrix will run one job for each package parallelly. | ||
- api-augment | ||
- types | ||
|
||
steps: | ||
- name: Checkout repository | ||
|
@@ -17,36 +23,16 @@ jobs: | |
- name: 🔐 Authenticate with NPM | ||
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTOMATION_TOKEN_CHRIS }}" > ~/.npmrc | ||
|
||
- name: Set package names | ||
id: set_package_names | ||
- name: Get dev version of ${{ matrix.package }} | ||
id: get-version | ||
run: | | ||
echo '["@oak-network/api-augment", "@oak-network/types"]' > packages.json | ||
- name: Setup Node.js environment | ||
uses: actions/[email protected] | ||
with: | ||
node-version: 18.x | ||
cache: 'npm' | ||
|
||
- name: Loop through Package Names | ||
id: loop-package-names | ||
dev_version=$(npm show @oak-network/${{ matrix.package }}@dev version) | ||
echo "Dev version: $dev_version" | ||
echo "::set-output name=dev_version::$dev_version" | ||
- name: Point latest tag to ${{ steps.get-version.outputs.dev_version }} | ||
run: | | ||
packages=$(cat packages.json) | ||
for package in $packages; do | ||
echo "Processing package: $package" | ||
# Get dev version | ||
dev_version=$(npm show $package@dev version) | ||
echo "Dev version: $dev_version" | ||
# Set latest tag | ||
npm dist-tag add $package@$dev_version latest --registry=https://registry.npmjs.org/ | ||
echo "Latest tag set to $dev_version" | ||
done | ||
npm dist-tag add @oak-network/${{ matrix.package }}@${{ steps.get-version.outputs.dev_version }} latest --registry=https://registry.npmjs.org/ | ||
echo "Latest tag set to ${{ steps.get-version.outputs.dev_version }}" | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_AUTOMATION_TOKEN_CHRIS }} | ||
|
||
- name: Use loop outputs | ||
run: | | ||
echo "Loop completed." |