1
0
mirror of https://github.com/simple-icons/simple-icons.git synced 2024-12-16 01:10:30 +02:00
simple-icons/.github/workflows/create-release.yml

76 lines
2.8 KiB
YAML
Raw Normal View History

name: Create Release Pull Request
on:
# THIS WORKFLOW SHOULD NEVER BE TRIGGERED ON A PUSH EVENT. IF TRIGGERED ON A
# PUSH EVENT IT MAY CREATE AN ENDLESS STREAM OF 'version bump' COMMITS.
workflow_dispatch:
schedule:
# "At 00:00 on Sunday" (https://crontab.guru/once-a-week)
- cron: '0 0 * * 0'
# This Workflow can be triggered manually through the GitHub UI or API. For the
# API use the following request:
# curl -X POST \
# -H "Authorization: Bearer <token>" \
# -d '{"ref":"develop"}' \
# https://api.github.com/repos/simple-icons/simple-icons/actions/workflows/create-release.yml/dispatches
# Replacing <token> by a personal access token with scope `public_repo`
jobs:
2021-03-03 12:57:33 +02:00
release-pr:
runs-on: ubuntu-latest
if: github.event_name != 'push'
2021-03-03 12:57:33 +02:00
outputs:
did-create-pr: ${{ steps.release.outputs.did-create-pr }}
new-version: ${{ steps.release.outputs.new-version }}
steps:
2024-01-03 08:32:32 +02:00
- uses: simple-icons/release-action@v1.1.0
2021-03-03 12:57:33 +02:00
id: release
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
2021-03-03 12:57:33 +02:00
version-bump:
runs-on: ubuntu-latest
needs: release-pr
if: |
github.event_name != 'push' &&
needs.release-pr.outputs.did-create-pr == 'true'
2021-03-03 12:57:33 +02:00
steps:
- name: Checkout
uses: actions/checkout@v4
2021-03-03 12:57:33 +02:00
with:
# Ensure the commit can be pushed regardless of branch protections (must belong to an admin of this repo)
token: ${{ secrets.RELEASE_TOKEN }}
2021-03-03 12:57:33 +02:00
# Ensure we are checked out on the develop branch
ref: develop
2023-09-17 22:56:03 +02:00
- name: Use Node.js 20.x
2023-08-01 20:06:45 +02:00
uses: actions/setup-node@v3
with:
2023-09-17 22:56:03 +02:00
node-version: 20.x
2023-08-01 20:06:45 +02:00
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-
2021-03-03 12:57:33 +02:00
- name: Bump version
2023-08-01 20:06:45 +02:00
run: |
npm version --no-commit-hooks --no-git-tag-version \
"${{ needs.release-pr.outputs.new-version }}"
- name: Install dependencies
run: npm i
- name: Update major version in CDN URLs
run: node ./scripts/release/update-cdn-urls.js
- name: Update SVGs count milestone
run: node ./scripts/release/update-svgs-count.js
2021-03-03 12:57:33 +02:00
- name: Update slugs table
run: node ./scripts/release/update-slugs-table.js
- name: Update SDK Typescript definitions
run: node ./scripts/release/update-sdk-ts-defs.js
2021-03-03 12:57:33 +02:00
- name: Commit version bump
uses: stefanzweifel/git-auto-commit-action@v5.0.0
2021-03-03 12:57:33 +02:00
with:
commit_message: version bump
commit_user_name: 'github-actions[bot]'
commit_user_email: 'github-actions[bot]@users.noreply.github.com'
commit_author: 'github-actions[bot] <github-actions[bot]@users.noreply.github.com>'