|
3 | 3 | push: |
4 | 4 | tags: |
5 | 5 | - '*' |
6 | | -permissions: |
7 | | - contents: write |
8 | 6 | jobs: |
| 7 | + publish: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + permissions: |
| 10 | + contents: read |
| 11 | + id-token: write |
| 12 | + steps: |
| 13 | + - name: Checkout the repository |
| 14 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 15 | + with: |
| 16 | + persist-credentials: false |
| 17 | + - name: Clean npm package |
| 18 | + uses: ai/clean-npm-project@3f664d1a83e04a2be737b7ad4e0b5a4e1b7dbc08 # v0.3.1 |
| 19 | + with: |
| 20 | + clean-docs: true |
| 21 | + - name: Install Node.js |
| 22 | + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 |
| 23 | + with: |
| 24 | + node-version: 26 |
| 25 | + package-manager-cache: false |
| 26 | + - name: Publish npm package |
| 27 | + run: npm stage publish |
| 28 | + working-directory: cleaned-project/ |
9 | 29 | release: |
10 | | - name: Release On Tag |
11 | | - if: startsWith(github.ref, 'refs/tags/') |
12 | 30 | runs-on: ubuntu-latest |
| 31 | + permissions: |
| 32 | + contents: write |
13 | 33 | steps: |
14 | 34 | - name: Checkout the repository |
15 | | - uses: actions/checkout@v4 |
16 | | - - name: Extract the changelog |
17 | | - id: changelog |
18 | | - run: | |
19 | | - TAG_NAME=${GITHUB_REF/refs\/tags\//} |
20 | | - READ_SECTION=false |
21 | | - CHANGELOG="" |
22 | | - while IFS= read -r line; do |
23 | | - if [[ "$line" =~ ^#+\ +(.*) ]]; then |
24 | | - if [[ "${BASH_REMATCH[1]}" == "$TAG_NAME" ]]; then |
25 | | - READ_SECTION=true |
26 | | - elif [[ "$READ_SECTION" == true ]]; then |
27 | | - break |
28 | | - fi |
29 | | - elif [[ "$READ_SECTION" == true ]]; then |
30 | | - CHANGELOG+="$line"$'\n' |
31 | | - fi |
32 | | - done < "CHANGELOG.md" |
33 | | - CHANGELOG=$(echo "$CHANGELOG" | awk '/./ {$1=$1;print}') |
34 | | - echo "changelog_content<<EOF" >> $GITHUB_OUTPUT |
35 | | - echo "$CHANGELOG" >> $GITHUB_OUTPUT |
36 | | - echo "EOF" >> $GITHUB_OUTPUT |
37 | | - - name: Create the release |
38 | | - if: steps.changelog.outputs.changelog_content != '' |
39 | | - uses: softprops/action-gh-release@v2 |
| 35 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
40 | 36 | with: |
41 | | - name: ${{ github.ref_name }} |
42 | | - body: '${{ steps.changelog.outputs.changelog_content }}' |
43 | | - draft: false |
44 | | - prerelease: false |
| 37 | + persist-credentials: false |
| 38 | + - name: Copy CHANGELOG.md to Releases |
| 39 | + uses: ai/copy-changelog-to-release@a6dc825c34575add2da2060796794f7b84894628 # v0.2.0 |
| 40 | + env: |
| 41 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments