github.com/jasoet/gopki@v1.15.0/.github/workflows/semantic.yml (about)

     1  name: Semantic Release
     2  
     3  on:
     4    push:
     5      branches:
     6        - main
     7    workflow_dispatch: # Allow manual trigger
     8  
     9  env:
    10    NODE_VERSION: 20
    11  
    12  jobs:
    13    semantic-release:
    14      name: Semantic Release
    15      runs-on: ubuntu-latest
    16      # Only run on push to main branch or manual trigger
    17      if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
    18  
    19      permissions:
    20        contents: write # Needed for creating releases and tags
    21        issues: write   # Needed for creating/labeling issues
    22        pull-requests: write # Needed for creating/labeling PRs
    23  
    24      steps:
    25        # Checkout repository with full history
    26        - name: Checkout repository
    27          uses: actions/checkout@v4
    28          with:
    29            fetch-depth: 0
    30            persist-credentials: false # Use GITHUB_TOKEN for auth
    31  
    32        # Setup Node.js for semantic-release
    33        - name: Setup Node.js
    34          uses: actions/setup-node@v4
    35          with:
    36            node-version: ${{ env.NODE_VERSION }}
    37  
    38        # Install semantic-release and plugins
    39        - name: Install semantic-release
    40          run: |
    41            npm init -y
    42            npm install --save-dev \
    43              semantic-release \
    44              @semantic-release/commit-analyzer \
    45              @semantic-release/release-notes-generator \
    46              @semantic-release/changelog \
    47              @semantic-release/github \
    48              @semantic-release/git \
    49              conventional-changelog-conventionalcommits
    50  
    51        # Run semantic-release
    52        - name: Run Semantic Release
    53          env:
    54            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    55          run: npx semantic-release