From 08f5ccfedacf78fe24c1dc522b0f1af7fb846558 Mon Sep 17 00:00:00 2001 From: Claudia Meadows Date: Tue, 24 Sep 2024 21:24:48 -0700 Subject: [PATCH] Merge test and `main` pre-release flow into a single file --- .github/workflows/test-main-push.yml | 33 ------------------------- .github/workflows/test.yml | 36 ++++++++++++++++++++++------ 2 files changed, 29 insertions(+), 40 deletions(-) delete mode 100644 .github/workflows/test-main-push.yml diff --git a/.github/workflows/test-main-push.yml b/.github/workflows/test-main-push.yml deleted file mode 100644 index f8f7bb1b..00000000 --- a/.github/workflows/test-main-push.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: test-main-push - -on: - push: - branches: [ main ] - workflow_dispatch: - -concurrency: prr:pre-release - -jobs: - test: - uses: ./.github/workflows/test.yml - - publish-prerelease: - needs: test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - - run: npm ci - - run: npm run build - - run: npx pr-release pr --verbose --target release --source main --compact --verbose --minimize-semver-change - env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - # The following will publish a prerelease to npm - - run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc - name: Setup NPM Auth - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - run: npx pr-release infer-prerelease --preid=next --target release --source main --verbose --publish --minimize-semver-change - name: Publish diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1ded9a67..ffc7ac8f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,18 +1,40 @@ -name: test +name: Test and maybe release on: pull_request_target: branches: [ main ] + push: + branches: [ main ] workflow_dispatch: - workflow_call: - -permissions: - actions: write - contents: read jobs: run-tests: uses: MithrilJS/infra/.github/workflows/run-tests.yml@main with: - all-platforms: true all-versions: true + permissions: + actions: write + contents: read + + publish-prerelease: + needs: run-tests + if: ${{ github.event_name == 'push' }} + concurrency: prr:pre-release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - run: npm ci + - run: npm run build + - run: npx pr-release pr --verbose --target release --source main --compact --verbose --minimize-semver-change + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + # The following will publish a prerelease to npm + - run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc + name: Setup NPM Auth + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - run: npx pr-release infer-prerelease --preid=next --target release --source main --verbose --publish --minimize-semver-change + name: Publish