From d237803413a314c901600d8f2db4501056dfcfea Mon Sep 17 00:00:00 2001 From: Eric Fennis Date: Mon, 22 Jul 2024 11:37:06 +0200 Subject: [PATCH] Adds semantic release step in CI action --- .github/workflows/ci.yml | 51 ++++++++++++---------------------------- 1 file changed, 15 insertions(+), 36 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b6f6fed5..7f0e3d1ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: if: github.repository == 'lucide-icons/lucide' runs-on: ubuntu-latest outputs: - VERSION: ${{ steps.new-version.outputs.NEW_VERSION }} + VERSION: ${{ steps.semantic.outputs.new_release_version }} steps: - uses: actions/checkout@v4 @@ -24,47 +24,26 @@ jobs: node-version: 18 cache: 'pnpm' - - name: Install dependencies - run: pnpm install --frozen-lockfile + - name: Semantic Release + id: semantic + uses: cycjimmy/semantic-release-action@v4 + with: + tag_format: ${version} + extra_plugins: | + @semantic-release/github + @semantic-release/git + @semantic-release/release-notes-generator + conventional-changelog-conventionalcommits - - name: Fetch tags - run: git fetch --all --tags - - - name: Get latest tag - id: latest-tag - run: echo "LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_OUTPUT - - - name: Check if we can patch - run: .github/workflows/version-up.sh --minor - - - name: Create new version - id: new-version - run: echo "NEW_VERSION=$(.github/workflows/version-up.sh --minor)" >> $GITHUB_OUTPUT - - - name: Create change log - id: change-log - run: | - CHANGE_LOG=$(pnpm run generate:changelog --old-tag=${{ steps.latest-tag.outputs.LATEST_TAG }}) - CHANGE_LOG=$(tail -n +5 <<< $CHANGE_LOG) - echo $CHANGE_LOG - EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) - echo "CHANGE_LOG<<$EOF" >> $GITHUB_OUTPUT - echo "$CHANGE_LOG" >> $GITHUB_OUTPUT - echo "$EOF" >> $GITHUB_OUTPUT env: - GITHUB_API_KEY: ${{ secrets.GITHUB_TOKEN }} - - - name: Check output - run: | - echo '${{ steps.new-version.outputs.NEW_VERSION }}' - echo '${{ steps.change-log.outputs.CHANGE_LOG }}' + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Create Release uses: softprops/action-gh-release@v1 with: - tag_name: ${{ steps.new-version.outputs.NEW_VERSION }} - name: New icons ${{ steps.new-version.outputs.NEW_VERSION }} - body: ${{ steps.change-log.outputs.CHANGE_LOG }} + tag_name: ${{ steps.semantic.outputs.new_release_version }} + name: Version ${{ steps.semantic.outputs.new_release_version }} + body: ${{ steps.semantic.outputs.new_release_notes }} start-release: if: github.repository == 'lucide-icons/lucide'