2020-11-28 13:34:36 +03:00
|
|
|
name: Publish
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
npm:
|
|
|
|
name: NPM Package
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Use Node.js 12.x
|
2020-12-21 15:55:32 +03:00
|
|
|
uses: actions/setup-node@v2
|
2020-11-28 13:34:36 +03:00
|
|
|
with:
|
|
|
|
node-version: 12.x
|
|
|
|
- name: Install dependencies
|
|
|
|
run: npm ci
|
|
|
|
- name: Sanity check
|
|
|
|
run: |
|
|
|
|
npm run lint
|
|
|
|
npm run test
|
|
|
|
- name: Deploy to NPM
|
|
|
|
uses: JS-DevTools/npm-publish@v1
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.NPM_TOKEN }}
|
|
|
|
github:
|
|
|
|
name: GitHub release
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Use Node.js 12.x
|
2020-12-21 15:55:32 +03:00
|
|
|
uses: actions/setup-node@v2
|
2020-11-28 13:34:36 +03:00
|
|
|
with:
|
|
|
|
node-version: 12.x
|
|
|
|
- name: Install dependencies
|
|
|
|
run: npm ci
|
|
|
|
- name: Sanity check
|
|
|
|
run: |
|
|
|
|
npm run lint
|
|
|
|
npm run test
|
|
|
|
- name: Get commit message (for release title and body)
|
|
|
|
id: commit
|
|
|
|
uses: kceb/git-message-action@v1
|
|
|
|
- name: Get release title and body
|
|
|
|
id: release
|
|
|
|
run: |
|
|
|
|
RELEASE_TITLE=$(echo '${{ steps.commit.outputs.git-message }}' | head -n 1)
|
|
|
|
echo "::set-output name=title::$RELEASE_TITLE"
|
|
|
|
RELEASE_BODY=$(echo '${{ steps.commit.outputs.git-message }}' | tail -n $(expr $(echo '${{ steps.commit.outputs.git-message }}' | wc -l) - 1))
|
|
|
|
echo "::set-output name=body::$RELEASE_BODY"
|
|
|
|
- name: Get release version
|
2020-12-20 14:43:16 +03:00
|
|
|
id: get-version
|
2020-11-28 13:34:36 +03:00
|
|
|
run: |
|
|
|
|
export PACKAGE_VERSION=$(cat package.json | grep 'version' | sed 's/[ \",:]//g' | sed 's/version//')
|
|
|
|
echo "::set-output name=version::$PACKAGE_VERSION"
|
|
|
|
- name: Create and push git tag
|
|
|
|
uses: actions-ecosystem/action-push-tag@v1
|
|
|
|
with:
|
2020-12-20 14:43:16 +03:00
|
|
|
tag: ${{ steps.get-version.outputs.version }}
|
2020-11-28 13:34:36 +03:00
|
|
|
message: ${{ steps.commit.outputs.git-message }}
|
|
|
|
- name: Create release
|
|
|
|
uses: actions/create-release@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
2020-12-20 14:43:16 +03:00
|
|
|
tag_name: ${{ steps.get-version.outputs.version }}
|
2020-11-28 13:34:36 +03:00
|
|
|
release_name: ${{ steps.release.outputs.title }}
|
|
|
|
body: ${{ steps.release.outputs.body }}
|
2021-01-01 21:29:47 +03:00
|
|
|
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.SIMPLE_ICONS_FONT_TOKEN }}" \
|
|
|
|
-d '{"ref":"develop"}' \
|
|
|
|
https://api.github.com/repos/simple-icons/simple-icons-font/actions/workflows/auto-release.yml/dispatches
|