mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-11-11 13:28:19 +00:00
* Add dispatch post release * Refine post-release automation conditions Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
161 lines
5.3 KiB
YAML
161 lines
5.3 KiB
YAML
name: Continuous integration icons
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- icons/**/*.svg
|
|
|
|
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:
|
|
check-dispatch-gate:
|
|
if: github.repository == 'lucide-icons/lucide' &&
|
|
startsWith(github.event.head_commit.message, 'feat(icons)') &&
|
|
github.event_name != 'workflow_dispatch'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
outputs:
|
|
RELEASE_ENVIRONMENT: ${{ steps.environment.outputs.RELEASE_ENVIRONMENT }}
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
|
|
- name: Fetch tags
|
|
run: git fetch --all --tags
|
|
|
|
- name: Check if latest tag was created today
|
|
id: environment
|
|
run: |
|
|
LATEST_TAG=$(git tag --sort=-v:refname | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)
|
|
TAG_DATE=$(git log -1 --format=%cs "$LATEST_TAG")
|
|
TODAY=$(date +%Y-%m-%d)
|
|
|
|
if [ "$TAG_DATE" == "$TODAY" ]; then
|
|
echo "::warning::A release tag already exists for today ($TODAY): $LATEST_TAG. Manual approval will be required to proceed."
|
|
echo "RELEASE_ENVIRONMENT=Icon Release Gated" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "RELEASE_ENVIRONMENT=Icon Release" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
create-release:
|
|
if: github.repository == 'lucide-icons/lucide'
|
|
needs: check-dispatch-gate
|
|
environment: ${{ needs.check-dispatch-gate.outputs.RELEASE_ENVIRONMENT }}
|
|
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@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
|
|
- 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: Fetch tags
|
|
run: git fetch --all --tags
|
|
|
|
- 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 if we can patch
|
|
run: pnpm semver $LATEST_TAG -i minor
|
|
env:
|
|
LATEST_TAG: ${{ steps.latest-tag.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: ${{ steps.latest-tag.outputs.LATEST_TAG }}
|
|
|
|
- name: Check output
|
|
run: |
|
|
echo '${{ steps.new-version.outputs.NEW_VERSION }}'
|
|
echo '${{ steps.change-log.outputs.CHANGE_LOG }}'
|
|
|
|
- name: Create Release
|
|
id: create-release
|
|
uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
|
|
with:
|
|
tag_name: ${{ steps.new-version.outputs.NEW_VERSION }}
|
|
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: >-
|
|
always() &&
|
|
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"
|