Skip to content

Commit

Permalink
Adjusted github workflow to allow releasing certain packages using di…
Browse files Browse the repository at this point in the history
…fferent distribution tags, such as beta
  • Loading branch information
Michael Weichert committed Sep 20, 2023
1 parent 11917f5 commit 8342705
Show file tree
Hide file tree
Showing 26 changed files with 132 additions and 100 deletions.
53 changes: 43 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,40 @@ jobs:
fi
echo "is_release=$IS_RELEASE" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
# Gather package info for publishing
gather-package-info:
runs-on: ubuntu-latest
outputs:
taggedPackages: ${{ steps.gather-packages.outputs.taggedPackages }}
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Gather package info
id: gather-packages
run: |
PACKAGES=$(npx lerna list --json)
TAGGED_PACKAGES=[]
for pkg in $(echo "${PACKAGES}" | jq -r '.[] | @base64'); do
pkg_name=$(echo "$pkg" | base64 --decode | jq -r '.name')
pkg_location=$(echo "$pkg" | base64 --decode | jq -r '.location')
pkg_tag=$(jq -r '.tag // "auto"' < "$pkg_location/package.json")
TAGGED_PACKAGES+=("{\"name\":\"$pkg_name\",\"tag\":\"$pkg_tag\"}")
done
TAGGED_PACKAGES_JSON="[$(IFS=,; echo "${TAGGED_PACKAGES[*]}")]"
echo "taggedPackages=$TAGGED_PACKAGES_JSON" >> "$GITHUB_OUTPUT"
# Publish NPM packages to Github Packages
publish-packages:
needs: [build-packages, check_is_release]
needs: [build-packages, check_is_release, gather-package-info]
runs-on: ubuntu-latest
strategy:
matrix:
package: ${{fromJson(needs.gather-package-info.outputs.taggedPackages)}}
steps:
- name: Download work archive
uses: actions/download-artifact@v2
Expand All @@ -201,16 +229,21 @@ jobs:
git config --global user.name "Michael Weichert"
git commit -am "chore: publish packages" --allow-empty
# Determine what tag to use. Our version numbers use the scheme MAJOR.MINOR.RELEASE. If RELEASE is 0, then we should use the "latest tag".
TAG=dev
if [[ "${{ needs.check_is_release.outputs.is_release }}" == "yes" ]]; then
echo "Publishing using latest tag"
TAG=latest
else
echo "Publishing using dev tag"
# Determine the appropriate NPM tag for publishing
# If the "tag" property from package.json is set to "auto",
# we rely on the "is_release" flag.
# Otherwise, we use the specified tag in package.json which should be set to "beta", "alpha", etc.
TAG=${{ matrix.package.tag }}
if [ "$TAG" == "auto" ]; then
TAG="dev"
if [[ "${{ needs.check_is_release.outputs.is_release }}" == "yes" ]]; then
TAG="latest"
fi
fi
npx lerna publish from-package --no-push --yes --dist-tag $TAG
# Use either Lerna or NPM Workspaces to publish this package
# For example:
npx lerna publish --scope=${{ matrix.package.name }} from-package --no-push --yes --dist-tag $TAG
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Builds for the latest release of Taqueria:
|---------|-----------------------------------------|
| MacOS | https://taqueria.io/get/macos/taq |
| Linux | https://taqueria.io/get/linux/taq |
| Windows | https://taqueria.io/get/windows/taq.exe |

Builds are also available on the [releases](https://github.com/pinnacle-labs/taqueria/releases) page on Github

Expand Down Expand Up @@ -92,8 +91,8 @@ If you prefer to build the Taqueria binary and plugins locally, follow the steps

#### Requirements

- [Deno](https://deno.land/) v1.34.x
- [NodeJS](https://nodejs.org/en/) v16.13 or later (but less than v17.x.x)
- [Deno](https://deno.land/) v1.36 or later
- [NodeJS](https://nodejs.org/en/) v16.13 or later
- [Docker](https://www.docker.com/) v0.9 or later

#### Run Build Script
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "0.39.24",
"version": "0.39.25",
"packages": [
"taqueria-protocol",
"taqueria-plugin*",
Expand Down
86 changes: 43 additions & 43 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@taqueria/root",
"version": "0.39.24",
"version": "0.39.25",
"description": "An easy to use opinionated tool for building, testing, and deploying Tezos software",
"main": "index.ts",
"directories": {
Expand Down
4 changes: 2 additions & 2 deletions taqueria-analytics/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@taqueria/analytics",
"version": "0.39.24",
"version": "0.39.25",
"description": "A TypeScript SDK submitting events for Taqueria activity",
"main": "./index.js",
"source": "./index.ts",
Expand Down Expand Up @@ -35,7 +35,7 @@
},
"homepage": "https://github.com/pinnacle-labs/taqueria#readme",
"dependencies": {
"@taqueria/protocol": "^0.39.24",
"@taqueria/protocol": "^0.39.25",
"node-machine-id-xz": "^1.0.2"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit 8342705

Please sign in to comment.