fix: further consolidates bump version #14
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: Deployment | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "main" | |
paths: | |
- ".github/workflows/**" | |
- "jest.config.js" | |
- "package.json" | |
- "src/**" | |
- "tests/**" | |
- "tsconfig.json" | |
- "yarn.lock" | |
permissions: | |
issues: write | |
contents: write | |
pull-requests: write | |
repository-projects: write | |
jobs: | |
continuous-deployment: | |
name: Deployment | |
runs-on: ubuntu-latest | |
steps: | |
- name: 👇 Checkout | |
uses: actions/checkout@v3 | |
- name: 🤹 Instal Deps | |
run: yarn install | |
- name: 🧪 Test | |
run: yarn test | |
- name: 🧱 Build | |
run: | | |
yarn build | |
if [ "$(git status --porcelain)" != "" ]; then | |
echo "GIT_IS_DIRTY=true" >> $GITHUB_ENV | |
else | |
echo "GIT_IS_DIRTY=false" >> $GITHUB_ENV | |
fi | |
- name: ✊ Bump Version | |
if: env.GIT_IS_DIRTY == 'true' | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
LATEST_TAG=$(gh api repos/endaft/$(basename $PWD)/releases/latest --jq=.tag_name) | |
IFS=. read -r v1 v2 v3 <<< "${LATEST_TAG}" # split into (integer) components | |
v3=$((v3 + 1)) # do the math | |
LATEST_TAG="${v1}.${v2}.${v3}" | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git commit -a -m "chore: updates dist js" | |
git tag -f "$LATEST_TAG" -m "Version $LATEST_TAG" | |
git tag -f latest -m "The latest version" | |
git push --follow-tags --force --tags |