diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml deleted file mode 100644 index 5c3e6bb..0000000 --- a/.github/workflows/preview.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Preview - -on: - pull_request: - types: [opened, synchronize, reopened, labeled] - branches: - - main - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - preview: - runs-on: ubuntu-latest - - if: ${{ startsWith(github.head_ref, 'feat') || startsWith(github.head_ref, 'fix') || contains(github.event.pull_request.labels.*.name, 'preview') }} - - permissions: - id-token: write - contents: read - - steps: - - name: ⬇️ Checkout repo - uses: actions/checkout@v4 - - - name: 🟢 Setup Node.js - uses: actions/setup-node@v6 - with: - node-version-file: .node-version - - - name: ⌛ Setup CI - uses: variableland/gh-actions/actions/setup-pnpm@main - - - name: 🚀 Preview release - uses: variableland/gh-actions/actions/preview-release@main - with: - npm_token: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ea0a0c3..55b2baf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,10 @@ on: push: branches: - main + pull_request: + types: [opened, synchronize, reopened, labeled] + branches: + - main concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -11,6 +15,7 @@ concurrency: jobs: release: + if: ${{ github.event_name == 'push' }} runs-on: ubuntu-latest permissions: id-token: write @@ -54,3 +59,26 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} LEFTHOOK: 0 + + preview: + if: ${{ github.event_name == 'pull_request' && (startsWith(github.head_ref, 'feat') || startsWith(github.head_ref, 'fix') || contains(github.event.pull_request.labels.*.name, 'preview')) }} + runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v4 + + - name: 🟢 Setup Node.js + uses: actions/setup-node@v6 + with: + node-version-file: .node-version + + - name: ⌛ Setup CI + uses: variableland/gh-actions/actions/setup-pnpm@main + + - name: 🚀 Preview release + uses: variableland/gh-actions/actions/preview-release@main + with: + npm_token: ${{ secrets.NPM_TOKEN }}