Skip to content

Commit

Permalink
chore: read published packages
Browse files Browse the repository at this point in the history
  • Loading branch information
openscript committed Sep 27, 2024
1 parent f1c4773 commit 4132193
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .changeset/polite-teachers-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"backend": patch
"frontend": patch
---

Read published packages
2 changes: 2 additions & 0 deletions .github/workflows/cd-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ jobs:
outputs:
ref: ${{ github.ref }}
published: ${{ steps.changesets.outputs.published }}
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}

deploy-to-registries:
name: Deploy to registries
uses: ./.github/workflows/cd-registries.yaml
needs: publish
with:
ref: ${{ needs.publish.outputs.ref }}
publishedPackages: ${{ needs.publish.outputs.publishedPackages }}
secrets: inherit
if: ${{ needs.publish.outputs.published }}
16 changes: 14 additions & 2 deletions .github/workflows/cd-registries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
ref:
required: true
type: string
publishedPackages:
required: true
type: string
workflow_dispatch:

env:
Expand Down Expand Up @@ -52,6 +55,15 @@ jobs:
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v4

- name: 'Build images'
run: INPUT_GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} pnpm nx affected --base=$NX_BASE --head=$NX_HEAD --target=container --parallel=2
- name: Build images
env:
INPUT_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for package in ${{ inputs.publishedPackages }}; do
NAME=$(echo $package | jq -r '.name')
VERSION=$(echo $package | jq -r '.version')
if pnpm nx show projects -t container | grep -q $NAME; then
pnpm nx run $NAME:container
fi
done
8 changes: 3 additions & 5 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@
"ghcr.io/openscript-ch/leq-{projectName}"
],
"tags": [
"type=schedule",
"type=ref,event=branch",
"type=ref,event=tag",
"type=ref,event=pr",
"type=sha,prefix=sha-"
"type=sha",
"version=latest",
"${VERSION}"
]
}
}
Expand Down

0 comments on commit 4132193

Please sign in to comment.