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
19 changes: 18 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
hasChangesets: ${{ steps.changesets.outputs.hasChangesets }}
releaseExists: ${{ steps.published.outputs.exists }}
permissions:
contents: write
pull-requests: write
Expand Down Expand Up @@ -41,10 +42,26 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check if publish is needed
id: published
if: steps.changesets.outputs.hasChangesets == 'false'
run: |
EXISTS=true
for PKG in $(npm query .workspace | jq -r '.[].name'); do
VERSION=$(npm query "#${PKG}" | jq -r '.[0].version')
if ! gh release view "${PKG}@${VERSION}" &>/dev/null; then
EXISTS=false
break
fi
done
echo "exists=${EXISTS}" >> "$GITHUB_OUTPUT"
Comment on lines +49 to +57
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👾 note: This is more complex for a workspace approach but should still let through a new package!

🧪 note: Tested with this change to find various truth values:

  "name": "@slack/web-api",
- "version": "7.15.1",
+ "version": "7.15.2",

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish:
name: Publish
needs: changelog
if: needs.changelog.outputs.hasChangesets == 'false'
if: needs.changelog.outputs.hasChangesets == 'false' && needs.changelog.outputs.releaseExists == 'false'
runs-on: ubuntu-latest
environment: publish
permissions:
Expand Down