diff --git a/.github/workflows/canary-release-pr.WIP b/.github/workflows/canary-release-pr.WIP deleted file mode 100644 index 0c5948948959..000000000000 --- a/.github/workflows/canary-release-pr.WIP +++ /dev/null @@ -1,88 +0,0 @@ -name: Publish canary release of PR -run-name: 'Canary release: PR #${{ github.event.pull_request.number }} at ${{ github.sha }}' - -on: - pull_request: - types: [opened, synchronize, reopened] - branches: - - next - -env: - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1 - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number }} - cancel-in-progress: true - -permissions: - pull-requests: write - -jobs: - release-canary: - name: Release canary version - runs-on: ubuntu-latest - environment: canary-release - defaults: - run: - working-directory: scripts - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: '16' - - - name: Cache dependencies - uses: actions/cache@v3 - with: - path: | - ~/.yarn/berry/cache - key: yarn-v1-${{ hashFiles('scripts/yarn.lock') }}-${{ hashFiles('code/yarn.lock') }} - restore-keys: | - yarn-v1-${{ hashFiles('scripts/yarn.lock') }}-${{ hashFiles('code/yarn.lock') }} - yarn-v1-${{ hashFiles('scripts/yarn.lock') }} - yarn-v1 - - - name: Install dependencies - working-directory: . - run: yarn task --task=install --start-from=install - - - name: Set version - id: version - run: | - SHORT_SHA=$(git rev-parse --short ${{ github.sha }}) - yarn release:version --release-type prerelease --pre-id pr-${{ github.event.pull_request.number }}-$SHORT_SHA --verbose - - - name: Publish v${{ steps.version.outputs.next-version }} - env: - YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - run: yarn release:publish --tag pr-${{ github.event.pull_request.number }} --verbose - - - name: Create comment on PR - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh pr comment ${{ github.event.pull_request.number }}\ - --repo "${{github.repository }}"\ - --body "🚀 This pull request has been published as version \`${{ steps.version.outputs.next-version }}\` and with the tag \`pr-${{ github.event.pull_request.number }}\`. - [You can see it on the npm registry here](https://npmjs.com/package/@storybook/cli/v/${{ steps.version.outputs.next-version }})". - - - name: Create failing comment on PR - if: failure() - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh pr comment ${{ github.event.pull_request.number }}\ - --repo "${{github.repository }}"\ - --body "Failed to publish canary version of this pul request. See the failed workflow run at See run at: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" - - # - name: Report failure to Discord - # if: failure() - # env: - # DISCORD_WEBHOOK: ${{ secrets.DISCORD_MONITORING_URL }} - # uses: Ilshidur/action-discord@master - # with: - # args: 'The GitHub Action for publishing version ${{ steps.version.outputs.current-version }} (triggered by ${{ github.triggering_actor }}) failed! See run at: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' diff --git a/.github/workflows/canary-release-pr.yml b/.github/workflows/canary-release-pr.yml new file mode 100644 index 000000000000..c12b0ca566b6 --- /dev/null +++ b/.github/workflows/canary-release-pr.yml @@ -0,0 +1,33 @@ +name: Publish canary release of PR +run-name: 'Canary release: PR #${{ inputs.pr }}, triggered by ${{ github.triggering_actor }}' + +on: + workflow_dispatch: + inputs: + pr: + description: 'Which pull request number to create a canary release for' + required: true + type: number + +env: + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 + PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1 + +concurrency: + group: ${{ github.workflow }}-${{ inputs.pr }} + cancel-in-progress: true + +permissions: + pull-requests: write + +jobs: + release-canary: + name: Release canary version + runs-on: ubuntu-latest + environment: release + defaults: + run: + working-directory: scripts + steps: + - name: Do nothing + run: echo "I'm not doing anything"