Files
Homepage/logos/simple-icons.manual-backup-20251123-234134/.github/workflows/publish.yml

150 lines
5.0 KiB
YAML

name: Publish Releases
on:
push:
branches:
- master
jobs:
sanity-check:
name: Pre-publish checks
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version-file: .node-version
cache: npm
cache-dependency-path: '**/package-lock.json'
- name: Install dependencies
run: npm ci --no-audit --no-fund
- name: Run linters
run: npm run lint
- name: Build NodeJS package
run: npm run build
- name: Run tests
run: npm run test
npm:
name: NPM Package
needs: sanity-check
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # for OIDC authentication
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version-file: .node-version
cache: npm
cache-dependency-path: '**/package-lock.json'
- id: get-version
uses: ./.github/actions/get-version
- name: Install dependencies
run: npm ci --no-audit --no-fund
- name: Reformat to regular markdown
run: node scripts/release/reformat-markdown.js "${{ steps.get-version.outputs.version }}"
- name: Update SDK Typescript definitions
run: node scripts/release/update-sdk-ts-defs.js
- name: Minify icons data file
run: node scripts/release/minify-icons-data.js
- name: Build NodeJS package
run: npm run build
- name: Deploy to NPM
run: npm publish
github:
name: GitHub release
needs: sanity-check
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v5
- name: Get commit message (for release title and body)
id: commit
uses: kceb/git-message-action@v3
- id: get-version
uses: ./.github/actions/get-version
- name: Reformat to regular markdown
run: node scripts/release/reformat-markdown.js "${{ steps.get-version.outputs.version }}"
- name: Configure GIT credentials
run: |
git config user.name "simple-icons[bot]"
git config user.email "simple-icons[bot]@users.noreply.github.com"
# Commit that will only be included in the tag
- name: Commit CDN theme image links removal
run: |
git add README.md
git commit -m 'Replace README CDN theme image links'
- name: Create and push git tag
run: |
set -e
tag="${{ steps.get-version.outputs.version }}"
git tag -a "${tag}" -m "$GIT_MESSAGE"
git push origin "${tag}"
env:
GIT_MESSAGE: ${{ steps.commit.outputs.git-message }}
- name: Create release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
with:
tag_name: ${{ steps.get-version.outputs.version }}
name: ${{ steps.commit.outputs.title }}
body: ${{ steps.commit.outputs.body }}
- name: Send release to Discord
run: node scripts/release/discord-release-message.js "${{ steps.get-version.outputs.version }}"
env:
DISCORD_RELEASES_ROLE_ID: ${{ secrets.DISCORD_RELEASES_ROLE_ID }}
DISCORD_RELEASES_WEBHOOK_URL: ${{ secrets.DISCORD_RELEASES_WEBHOOK_URL }}
continue-on-error: true
font:
name: Trigger simple-icons-font release
needs: npm
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
repositories: 'simple-icons-font'
- name: Trigger simple-icons-font release
run: |
curl -X POST \
-H "Authorization: Bearer ${{ steps.app-token.outputs.token }}" \
-d '{"ref":"develop"}' \
https://api.github.com/repos/simple-icons/simple-icons-font/actions/workflows/auto-release.yml/dispatches
website:
name: Trigger simpleicons.org website update
needs: npm
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
repositories: 'simple-icons-website-rs'
- name: Trigger simpleicons.org website update
run: |
curl -X POST \
-H "Authorization: Bearer ${{ steps.app-token.outputs.token }}" \
-d '{"ref":"master"}' \
https://api.github.com/repos/simple-icons/simple-icons-website-rs/actions/workflows/auto-release.yml/dispatches