Skip to content

Refresh page on consent change #358

Refresh page on consent change

Refresh page on consent change #358

name: Publish Beta Package
# This workflow is triggered on a label being added to a PR, and will publish a beta version of the bundle to npm
# Use `yarn changeset add` to add a new change
# This action will release the changeset as a pre-release, and add a comment to the PR with the version number
on:
pull_request:
types: [labeled]
permissions: write-all
jobs:
has-permission:
name: Check permissions
runs-on: ubuntu-latest
steps:
- name: 'Check if user has admin access'
uses: 'lannonbr/repo-permission-check-action@2.0.2'
with:
permission: 'admin'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
name: '@guardian/commercial'
runs-on: ubuntu-latest
needs: has-permission
if: github.event.label.name == '[beta] @guardian/commercial'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v3
with:
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build package
run: yarn build
- name: Version
run: yarn changeset version --snapshot beta
- name: Create Release
uses: changesets/action@v1
id: changeset
with:
publish: yarn changeset publish --tag beta
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const publishedPackages = ${{ steps.changeset.outputs.publishedPackages }};
const version = publishedPackages[0].version;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `🚀 ${version} published to npm as a beta release`
})