Skip to content

Create Release Pull Request #81

Create Release Pull Request

Create Release Pull Request #81

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:
release-pr:
runs-on: ubuntu-latest
if: github.event_name != 'push'
outputs:
did-create-pr: ${{ steps.release.outputs.did-create-pr }}
new-version: ${{ steps.release.outputs.new-version }}
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
- uses: simple-icons/release-action@v1
id: release
with:
repo-token: ${{ steps.app-token.outputs.token }}
version-bump:
runs-on: ubuntu-latest
needs: release-pr
if: |
github.event_name != 'push' &&
needs.release-pr.outputs.did-create-pr == 'true'
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v4
with:
# Ensure the commit can be pushed regardless of branch protections (must belong to an admin of this repo)
token: ${{ steps.app-token.outputs.token }}
# Ensure we are checked out on the develop branch
ref: develop
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: '**/package.json'
- name: Bump version
run: |
npm version --no-commit-hooks --no-git-tag-version \
"${{ needs.release-pr.outputs.new-version }}"
- name: Install dependencies
run: npm i --ignore-scripts --no-audit --no-fund
- name: Update major version in CDN URLs
run: ./scripts/release/update-cdn-urls.js
- name: Update SVGs count milestone
run: ./scripts/release/update-svgs-count.js
- name: Update slugs table
run: ./scripts/release/update-slugs-table.js
- name: Update SDK Typescript definitions
run: ./scripts/release/update-sdk-ts-defs.js
- name: Commit version bump
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: version bump
commit_user_name: 'simple-icons[bot]'
commit_user_email: 'simple-icons[bot]@users.noreply.github.com'
commit_author: 'simple-icons[bot] <simple-icons[bot]@users.noreply.github.com>'