Skip to content

test

test #3

Workflow file for this run

name: Build
on:
push:
if: ${{ GITHUB_ACTOR != 'github-actions[bot]' }}

Check failure on line 4 in .github/workflows/build.yaml

View workflow run for this annotation

GitHub Actions / Build

Invalid workflow file

The workflow is not valid. .github/workflows/build.yaml (Line: 4, Col: 9): Unrecognized named-value: 'GITHUB_ACTOR'. Located at position 1 within expression: GITHUB_ACTOR != 'github-actions[bot]'
branches:
- master
- track-version
workflow_dispatch:
jobs:
track-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get changed folders
id: changed
run: |
changed=$(git diff --name-only HEAD^ HEAD | grep src/ | cut -d '/' -f 2 | uniq)
echo ::set-output name=folders::${changed}
- name: Update versions
if: ${{ steps.changed.outputs.folders != '' }}
run: |
incr_version() {
local version=$1
local major=$(echo $version | cut -d. -f1)
local minor=$(echo $version | cut -d. -f2)
local patch=$(echo $version | cut -d. -f3)
if [[ $patch == *"-"* ]]; then
prerelease=$(echo $version | cut -d. -f4)
local new_prerelease=$(($prerelease + 1))
echo "$major.$minor.$patch.$new_prerelease"
elif [[ $minor == *"-"* ]]; then
prerelease="0"
local new_minor=$(($minor + 1))
echo "$major.$new_minor.$patch-$prerelease"
elif [[ $major == *"-"* ]]; then
minor="0"
patch="0"
prerelease="0"
local new_major=$(($major + 1))
echo "$new_major.$minor.$patch-$prerelease"
else
local new_patch=$(($patch + 1))
echo "$major.$minor.$new_patch"
fi
}
for folder in ${{ steps.changed.outputs.folders }}; do
folder_path="src/$folder"
version=$(jq -r '.version' $folder_path/config.js)
new_version=$(incr_version $version)
sed -i "s/\"version\":.*/\"version\": \"$new_version\"/" $folder_path/config.js
git config --local user.email github-actions[bot]@users.noreply.github.com
git config --local user.name github-actions[bot]
git config --global core.autocrlf true
git config --global core.safecrlf false
git commit -m "Update version for $folder" $folder_path/config.js
git push origin HEAD:track-version
done
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup pnpm
uses: pnpm/action-setup@v2.2.4
with:
version: latest
run_install: true
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm run build
- name: Git commit
id: commit
run: |
git config --local user.email github-actions[bot]@users.noreply.github.com
git config --local user.name github-actions[bot]
git config --global core.autocrlf true
git config --global core.safecrlf false
git add -f out
git commit -m "CI build"
- name: Push to releases
run: |
git push -f origin HEAD:releases