diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index dc4d8a9..5425f7d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,25 +1,30 @@ name: Build and Release QHotkeys +# Every push to the main branch on: push: - branches: - - main # Set this to the branch you want to build from + branches: [ main ] jobs: publish: name: Publish to npm - if: github.event_name == 'push' && github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '[publish]') + if: '!startsWith(github.event.head_commit.message, "[ci-skip]")' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - name: Fetch project + uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 with: node-version: '20' registry-url: 'https://registry.npmjs.org' - - run: npm ci - - run: npm run build + - name: Install dependencies + run: npm ci + - name: Build project + run: npm run build - name: Publish to npm - id: publish # Assign an ID to this step + if: contains(github.event.head_commit.message, '[publish]') + id: publish run: npm publish --access public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file