Build #805
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 10 * * *" | |
jobs: | |
get-version: | |
runs-on: ubuntu-latest | |
outputs: | |
modified: ${{ steps.git-check.outputs.modified }} | |
version: ${{ steps.get-version.outputs.version }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Fetch release version | |
id: get-version | |
run: | | |
version=$(curl -sL https://api.github.com/repos/simple-icons/simple-icons/releases | jq -r ".[0].tag_name") | |
echo $version > simpleicons.latest.txt | |
echo ::set-output name=version::${version} | |
- name: Check for modified files | |
id: git-check | |
run: | | |
echo ::set-output name=modified::$([ -z "`git status --porcelain`" ] && echo "false" || echo "true") | |
- name: Commit latest release version | |
if: steps.git-check.outputs.modified == 'true' | |
run: | | |
git config --global user.email "action@github.com" | |
git config --global user.name "github-actions" | |
git commit -am "Simpleicons Release v${{ steps.get-version.outputs.version }}" | |
git push | |
build: | |
runs-on: ubuntu-latest | |
needs: get-version | |
if: needs.get-version.outputs.modified == 'true' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Pull | |
run: | | |
git pull | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "15" | |
- name: Build Webpack | |
run: | | |
npm install | |
npm i simple-icons@${{ needs.get-version.outputs.version }} | |
npm run build | |
- name: Set package.json version | |
run: | | |
npm version -commit-hooks false -git-tag-version false ${{ needs.get-version.outputs.version }} | |
- name: Commit | |
run: | | |
git config --global user.email "action@github.com" | |
git config --global user.name "github-actions" | |
git add . | |
git commit --allow-empty -m "Release v${{ needs.get-version.outputs.version }}" | |
git push | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ needs.get-version.outputs.version }} | |
name: v${{ needs.get-version.outputs.version }} | |
body: | | |
See [Simpleicons release](https://github.com/simple-icons/simple-icons/releases/tag/${{ needs.get-version.outputs.version }}) |