Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ jobs:
[ "$fail" -eq 0 ]

- name: Publish
id: publish
env:
DIST_TAG: ${{ needs.build.outputs.dist_tag }}
run: |
Expand All @@ -292,10 +293,20 @@ jobs:
# npm error git@github.com: Permission denied (publickey).
# which reads like an auth failure and is nothing of the sort. A
# leading ./ is what makes it unambiguously a path.
# Names are read back out of the tarballs rather than hardcoded, so
# the PR comment cannot drift when a package is added or renamed.
names=""
for tgz in artifacts/*.tgz; do
echo "publishing $(basename "$tgz") to @$DIST_TAG"
npm publish "./$tgz" --tag "$DIST_TAG"
name=$(tar -xzOf "$tgz" package/package.json | node -p 'JSON.parse(require("fs").readFileSync(0,"utf8")).name')
names="$names$name"$'\n'
done
{
echo "packages<<EOF"
printf '%s' "$names"
echo EOF
} >> "$GITHUB_OUTPUT"

# Tells the PR author how to install what was just published. The
# experimental dist-tag is clobbered by the next build, so the comment
Expand All @@ -306,9 +317,13 @@ jobs:
env:
VERSION: ${{ needs.build.outputs.version }}
PR_NUMBER: ${{ github.event.inputs.pr_number }}
PACKAGES: ${{ steps.publish.outputs.packages }}
with:
script: |
const version = process.env.VERSION;
const sha = version.replace(/^0\.0\.0-experimental\./, '');
const packages = process.env.PACKAGES.split('\n').filter(Boolean);
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
const marker = '<!-- experimental-build -->';
const body = [
marker,
Expand All @@ -318,13 +333,14 @@ jobs:
'|---|---|',
'| **Version** | `' + version + '` |',
'| **Dist tag** | `experimental` |',
'| **Commit** | `' + version.replace(/^0\.0\.0-experimental\./, '').slice(0, 7) + '` |',
'| **Commit** | `' + sha.slice(0, 7) + '` |',
'| **Run** | [' + context.runId + '](' + runUrl + ') |',
'',
'Published at this version:',
'',
'```bash',
'npm install @strapi-community/plugin-rest-cache@' + version,
'```',
...packages.map((name) => '- `' + name + '`'),
'',
'Install by exact version. The `experimental` tag moves with every build.',
'Install by exact version - the `experimental` tag moves with every build.',
'',
'The `publish-experimental` label has been removed. Add it again to publish another build.',
].join('\n');
Expand Down
Loading