chore(seo): adds seo tags #49
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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: 📈 Bumps - Semver version | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: [ main ] | |
workflow_dispatch: | |
env: | |
node_version: 20.x | |
jobs: | |
version: | |
name: Bump version | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, 'chore')" | |
env: | |
old_version: '' | |
new_version: '' | |
steps: | |
- name: ⛙ Checkout branch ${{ github.ref }} | |
uses: actions/checkout@v4 | |
- name: 🏗️ Setup Node.js ${{ env.node_version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.node_version }} | |
cache: 'yarn' | |
- name: 📈 Bump version | |
run: | | |
# ================= 📈 Bump package version ================= | |
# Save old version to env | |
echo "old_version=$(jq -r .version package.json)" >> $GITHUB_ENV | |
# extract commit version | |
message=$(git log -1 --pretty=format:"%s") | |
# install standard-version | |
yarn add global standard-version | |
# bump version | |
yarn version | |
# Save new version to env | |
echo "new_version=$(jq -r .version package.json)" >> $GITHUB_ENV | |
- name: 📈 Write version to manifest.json | |
run: | | |
# ================= 📈 Bump manifest.json ================= | |
# Move to src folder | |
cd ./src | |
# Replace manifest version to align with package.json | |
manifest_version=$(jq -r .version manifest.json) | |
tmp=$(mktemp) | |
jq --arg new_version "$new_version" '.version = $new_version' manifest.json > "$tmp" && mv "$tmp" manifest.json | |
echo "Manifest version changed from '$manifest_version' to '$(jq -r .version manifest.json)'" | |
- name: ⛙ Commit files | |
run: | | |
# ================= ⛙ Commit changes ================= | |
# setup the username and email. I tend to use 'GitHub Actions Bot' with no email by default | |
git config user.name "GitHub Bump Version Bot" | |
git config user.email "<>" | |
# Stage the file, commit and push | |
git status | |
git diff --color -U0 | cat | |
git add package.json yarn.lock src/manifest.json | |
git commit -m "chore(version): bumping version from '${{ env.old_version }}' to '${{ env.new_version }}'" | |
git push origin | |
- name: 🏷️ Tag release candidate | |
run: | | |
# ================= 🏷️ Tag release candidate ================= | |
old_tag="v${{ env.old_version }}-rc" | |
new_tag="v${{ env.new_version }}-rc" | |
# create new release candidate tag | |
echo "New release candidate tag $new_tag" | |
git tag "$new_tag" | |
git push origin "$new_tag" | |
# delete previous release candidate tag | |
git ls-remote --exit-code -q origin "refs/tags/$old_tag" | |
if [ "$?" == 0 ]; then | |
echo "Old release candidate tag found $old_tag" | |
git push --delete origin "$old_tag" | |
else | |
echo "No tag found for $old_tag" | |
fi |