1
0
mirror of https://github.com/simple-icons/simple-icons.git synced 2024-11-26 01:00:27 +02:00
simple-icons/.github/workflows/publish.yml
2023-11-05 19:35:53 +00:00

124 lines
4.0 KiB
YAML

name: Publish Releases
on:
push:
branches:
- master
jobs:
sanity-check:
name: Pre-publish checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm i
- 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
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-
- id: get-version
uses: ./.github/actions/get-version
- name: Install dependencies
run: npm i
- name: Replace CDN theme image links from README
run: node ./scripts/release/strip-theme-links.js "${{ steps.get-version.outputs.version }}"
- name: Update SDK Typescript definitions
run: node ./scripts/release/update-sdk-ts-defs.js
- name: Build NodeJS package
run: npm run build
- name: Deploy to NPM
uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
github:
name: GitHub release
needs: sanity-check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get commit message (for release title and body)
id: commit
uses: kceb/git-message-action@v2
- id: get-version
uses: ./.github/actions/get-version
- name: Replace CDN theme image links from README
run: node ./scripts/release/strip-theme-links.js "${{ steps.get-version.outputs.version }}"
- name: Configure GIT credentials
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@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 "${{ steps.commit.outputs.git-message }}"
git push origin "${tag}"
- name: Create release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get-version.outputs.version }}
release_name: ${{ steps.commit.outputs.title }}
body: ${{ steps.commit.outputs.body }}
font:
name: Trigger simple-icons-font release
needs: npm
runs-on: ubuntu-latest
steps:
- name: Trigger simple-icons-font release
run: |
curl -X POST \
-H "Authorization: Bearer ${{ secrets.REMOTE_DISPATCH_TOKEN }}" \
-d '{"ref":"develop"}' \
https://api.github.com/repos/simple-icons/simple-icons-font/actions/workflows/auto-release.yml/dispatches
website:
name: Trigger simple-icons-website update
needs: npm
runs-on: ubuntu-latest
steps:
- name: Trigger simple-icons-website update
run: |
curl -X POST \
-H "Authorization: Bearer ${{ secrets.REMOTE_DISPATCH_TOKEN }}" \
-d '{"ref":"master"}' \
https://api.github.com/repos/simple-icons/simple-icons-website/actions/workflows/auto-release.yml/dispatches