name: Continuous integration icons on: push: branches: - main paths: - icons/*.svg schedule: - cron: '0 6 * * *' workflow_dispatch: inputs: version: description: Version required: true tag: required: true description: NPM tag default: 'latest' type: choice options: - latest - next - beta - alpha permissions: {} jobs: release-gate: concurrency: group: ci-${{ github.event_name == 'schedule' && github.ref || 'release-gated' }} cancel-in-progress: true if: github.repository == 'lucide-icons/lucide' && github.event_name != 'workflow_dispatch' environment: ${{ github.event_name == 'schedule' && 'Icon Release' || 'Icon Release Gated' }} runs-on: ubuntu-latest steps: - name: Approve release run: echo 'Release approved' prepare-release: needs: release-gate runs-on: ubuntu-latest permissions: contents: read # Required to check if a new release is needed outputs: SHOULD_RELEASE: ${{ steps.changes.outputs.SHOULD_RELEASE }} LATEST_TAG: ${{ steps.latest-tag.outputs.LATEST_TAG }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 - name: Get latest tag id: latest-tag run: echo "LATEST_TAG=$(git tag --sort=-v:refname | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)" >> "$GITHUB_OUTPUT" - name: Log latest tag run: echo '${{ steps.latest-tag.outputs.LATEST_TAG }}' - name: Check for releasable changes id: changes env: LATEST_TAG: ${{ steps.latest-tag.outputs.LATEST_TAG }} run: | if [ -z "$LATEST_TAG" ]; then echo "::error::No version tag found to release from." exit 1 fi echo "Latest version tag: $LATEST_TAG" CHANGES=$(git diff --name-only "$LATEST_TAG" HEAD -- ':(glob)icons/*.svg') if [ -z "$CHANGES" ]; then echo "::notice::No icon SVGs changed since $LATEST_TAG. Skipping release." echo "SHOULD_RELEASE=false" >> "$GITHUB_OUTPUT" exit 0 fi echo "$CHANGES" echo "SHOULD_RELEASE=true" >> "$GITHUB_OUTPUT" create-release: if: github.repository == 'lucide-icons/lucide' && needs.prepare-release.outputs.SHOULD_RELEASE == 'true' needs: prepare-release runs-on: ubuntu-latest permissions: contents: write # Required to create the release and tag outputs: VERSION: ${{ steps.new-version.outputs.NEW_VERSION }} RELEASE_URL: ${{ steps.create-release.outputs.url }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 with: cache: 'pnpm' node-version-file: 'package.json' - name: Install dependencies run: pnpm install --frozen-lockfile - name: Check if we can patch run: pnpm semver "$LATEST_TAG" -i minor env: LATEST_TAG: ${{ needs.prepare-release.outputs.LATEST_TAG }} - name: Create new version id: new-version run: echo "NEW_VERSION=$(pnpm semver "$LATEST_TAG" -i minor)" >> "$GITHUB_OUTPUT" env: LATEST_TAG: ${{ needs.prepare-release.outputs.LATEST_TAG }} - name: Check output run: echo '${{ steps.new-version.outputs.NEW_VERSION }}' - name: Create Release id: create-release uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3 with: tag_name: ${{ steps.new-version.outputs.NEW_VERSION }} target_commitish: ${{ github.sha }} name: Version ${{ steps.new-version.outputs.NEW_VERSION }} generate_release_notes: true start-release: if: github.repository == 'lucide-icons/lucide' needs: create-release uses: './.github/workflows/release.yml' secrets: inherit permissions: id-token: write # Required for OIDC (npm provenance) contents: write # Required to upload release assets with: version: ${{ needs.create-release.outputs.VERSION }} dispatch-release: if: github.repository == 'lucide-icons/lucide' && github.event_name == 'workflow_dispatch' uses: './.github/workflows/release.yml' secrets: inherit permissions: id-token: write # Required for OIDC (npm provenance) contents: write # Required to upload release assets with: version: ${{ inputs.version }} tag: ${{ inputs.tag }} post-release: name: Trigger post-release automation if: >- !cancelled() && github.repository == 'lucide-icons/lucide' && (needs.start-release.result == 'success' || needs.dispatch-release.result == 'success') needs: [create-release, start-release, dispatch-release] runs-on: ubuntu-latest permissions: {} steps: - name: Dispatch post_release event env: GH_TOKEN: ${{ secrets.POST_RELEASE_TOKEN }} RELEASE_TAG: ${{ needs.create-release.outputs.VERSION || inputs.version }} RELEASE_URL: ${{ needs.create-release.outputs.RELEASE_URL }} run: | if [ -z "$RELEASE_URL" ]; then RELEASE_URL="https://github.com/lucide-icons/lucide/releases/tag/$RELEASE_TAG" fi gh api \ --method POST \ repos/lucide-icons/post-release/dispatches \ --field event_type=post_release \ --field "client_payload[release_tag]=$RELEASE_TAG" \ --field "client_payload[release_url]=$RELEASE_URL"