diff --git a/.changeset/cold-fireants-provide.md b/.changeset/cold-fireants-provide.md new file mode 100644 index 000000000000..509464905a81 --- /dev/null +++ b/.changeset/cold-fireants-provide.md @@ -0,0 +1,5 @@ +--- +wrangler: patch +--- +CI/CD +- Release flow triggered on PR's closed diff --git a/.github/workflows/prereleases.yml b/.github/workflows/prereleases.yml index cc37f1492009..a662d44e927b 100644 --- a/.github/workflows/prereleases.yml +++ b/.github/workflows/prereleases.yml @@ -1,26 +1,27 @@ name: Prerelease on: - push: - branches: - - main + workflow_run: + workflows: ["Tests, Linter & Typecheck"] + branches: ["main"] + types: + - completed jobs: build: - if: ${{ github.repository_owner == 'cloudflare' }} + + if: ${{ github.repository_owner == 'cloudflare' && github.event.workflow_run.conclusion == 'success' }} name: Build & Publish an alpha release to NPM runs-on: ubuntu-latest - strategy: - matrix: - node_version: [16.7] steps: - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node_version }} + + - name: Use Node.js 16.7 uses: actions/setup-node@v2 with: - node-version: ${{ matrix.node_version }} - + node-version: 16.7 + - uses: actions/cache@v2 with: path: ~/.npm diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1313921097a4..85d7b56be104 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,61 +1,42 @@ - name: Release on: pull_request: types: [closed] - branches: - - changeset-release/main jobs: - build: - if: ${{ github.event.pull_request.merged == true }} - name: Build & Publish an alpha release to NPM + release: + if: ${{github.event.pull_request.merged}} + name: Release runs-on: ubuntu-latest - strategy: - matrix: - node_version: [16.7] - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node_version }} - uses: actions/setup-node@v2 + - name: Checkout Repo + uses: actions/checkout@v2 with: - node-version: ${{ matrix.node_version }} + fetch-depth: 0 + - name: Copy README.md + run: cp README.md packages/wrangler/README.md + + - name: Use Node.js 16.7 + uses: actions/setup-node@v2 + with: + node-version: 16.7 + - uses: actions/cache@v2 with: path: ~/.npm key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - + - name: Install NPM dependencies run: npm install - - name: Copy README.md - run: cp README.md packages/wrangler/README.md - - name: Build run: npm run build working-directory: packages/wrangler - release: - if: ${{ github.event.pull_request.merged == true }} - needs: [build] - name: Release - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Setup Node.js 16.7 - uses: actions/setup-node@v2 - with: - node-version: 16.7 - - name: Publish to NPM id: changesets uses: changesets/action@v1 @@ -63,4 +44,4 @@ jobs: publish: npx changeset publish --tag beta env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_PUBLISH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} \ No newline at end of file + NPM_PUBLISH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}