Skip to content

Commit

Permalink
chore: update prerelease workflow to tag latest prerelease with next …
Browse files Browse the repository at this point in the history
…npm tag on publish
  • Loading branch information
alessbell committed Sep 19, 2023
1 parent fb9457d commit f7f276f
Showing 1 changed file with 6 additions and 35 deletions.
41 changes: 6 additions & 35 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,6 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get package version from package.json
id: package-version
uses: martinbeentjes/npm-get-version-action@main

- name: Get npm tag from pre.json
id: tag
uses: notiz-dev/[email protected]
with:
path: ".changeset/pre.json"
prop_path: "tag"

- name: Publish to npm + GitHub
id: changesets
# Only run publish if we're still in pre mode and the last commit was
Expand All @@ -84,11 +73,15 @@ jobs:
uses: changesets/action@v1
with:
version: echo "This step should never version"
publish: npm run changeset-publish -- --tag next # by default, this will publish to npm and GitHub
publish: npm run changeset-publish # by default, this will publish to npm and GitHub
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Tag release with next on npm
if: steps.changesets.outcome == 'success'
run: npm dist-tag add @apollo/client@${{ fromJson(steps.changesets.outputs.publishedPackages)[0].version }} next

- name: Send a Slack notification on publish
if: steps.changesets.outcome == 'success'
id: slack
Expand All @@ -99,37 +92,15 @@ jobs:
# You can pass in multiple channels to post to by providing
# a comma-delimited list of channel IDs
channel-id: "C01PS0CB41G"
# For posting a simple plain text message
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "A new version of `@apollo/client` was released :rocket:"
"text": "A new version of `@apollo/client` was released: <https://github.com/apollographql/apollo-client/releases/tag/v${{ fromJson(steps.changesets.outputs.publishedPackages)[0].version }}|v${{ fromJson(steps.changesets.outputs.publishedPackages)[0].version }}> :rocket:"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Version:*\n`${{ steps.package-version.outputs.current-version}}`"
},
{
"type": "mrkdwn",
"text": "*Tag:*\n`${{steps.tag.outputs.prop}}`"
},
{
"type": "mrkdwn",
"text": "*GitHub release:*\nN/A"
},
{
"type": "mrkdwn",
"text": "*npm releases:*\n<https://www.npmjs.com/package/@apollo/client?activeTab=versions|link>"
}
]
}
]
}
Expand Down

0 comments on commit f7f276f

Please sign in to comment.