Skip to content

Automated Releases #191

Automated Releases

Automated Releases #191

Workflow file for this run

name: Automated Releases
on: workflow_dispatch
# This Workflow is triggered through the GitHub API:
# curl -X Post \
# -H "Authorization: Bearer <token>" \
# -d '{"ref":"develop"}' \
# https://api.github.com/repos/simple-icons/simple-icons-font/actions/workflows/auto-release.yml/dispatches
# Replacing <token> by a personal access token with scope `public_repo`
jobs:
auto-release:
name: Automated release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Ensure we are checked out on the develop branch
ref: develop
# Ensure custom credentials are used when pushing
persist-credentials: false
# Fetch everything so we can checkout master
fetch-depth: 0
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Update README CDN URLs
run: |
# Update the CDN URLs in the README
node scripts/update-cdn-urls.js
- name: Update simple-icons dependency and package version
id: update
run: |
newVersion="$(node scripts/bump-version.js)"
echo "new-version=$newVersion" >> $GITHUB_OUTPUT
- name: Sanity check
run: npm run build
- name: Commit updates
run: |
# Set up git credential
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
# Create a version bump commit
git add .
git commit -m "Version bump"
- name: Merge develop into master
run: |
git checkout master
git merge develop --no-ff -m "Release ${{ steps.update.outputs.new-version }}"
- name: Push version bump
run: |
# Set up remote using a Personal Access Token
git remote remove origin
git remote add origin https://${{ secrets.RELEASE_TOKEN }}@github.com/simple-icons/simple-icons-font.git
# Push develop first, to prevent conflicts with parallel activity
git push origin develop
# Push master only after develop was safely pushed
git push origin master