Skip to content

Update r.yml

Update r.yml #2

Workflow file for this run

name: Release
on:
workflow_dispatch:
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Compute version info
id: ver
run: |
SHORT=$(git rev-parse --short HEAD)
# versionCode = total number of commits
CODE=$(git rev-list --count HEAD)
# bump minor version from current module.prop major
MAJOR=$(grep '^version=' module.prop | sed 's/version=\([0-9]*\).*/\1/')
VERSION="${MAJOR}.$(( CODE )) (${CODE}-${SHORT}-release)"
TAG="v${MAJOR}.${CODE}-${SHORT}"
echo "short=$SHORT" >> $GITHUB_OUTPUT
echo "code=$CODE" >> $GITHUB_OUTPUT
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=$TAG" >> $GITHUB_OUTPUT
- name: Generate sha256 files
run: |
# Find all files except .sha256, .git, and update.Json (which changes post-build)
find . \
-not -path './.git/*' \
-not -path './.github/*' \
-not -name '*.sha256' \
-not -name 'update.Json' \
-type f | while read -r f; do
sha256sum "$f" | awk '{print $1}' > "${f}.sha256"
done
- name: Update module.prop
run: |
sed -i "s/^version=.*/version=${{ steps.ver.outputs.version }}/" module.prop
sed -i "s/^versionCode=.*/versionCode=${{ steps.ver.outputs.code }}/" module.prop
- name: Build zip
id: zip
run: |
ZIPNAME="YetAnotherBootloopProtector-${{ steps.ver.outputs.code }}-${{ steps.ver.outputs.tag }}.zip"
# Exclude .git, update.Json (updated separately after release), and README
zip -r "$ZIPNAME" . \
-x '.git/*' \
-x '.github/*' -x '.github/**/*' \
-x 'update.Json' \
-x 'README.md' \
-x '*.zip'
echo "zipname=$ZIPNAME" >> $GITHUB_OUTPUT
- name: Create GitHub release
id: release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.ver.outputs.tag }}
name: ${{ steps.ver.outputs.version }}
body_path: changelog.md
files: ${{ steps.zip.outputs.zipname }}
- name: Update update.Json
run: |
cat > update.Json <<EOF
{
"versionCode": ${{ steps.ver.outputs.code }},
"version": "${{ steps.ver.outputs.version }}",
"zipUrl": "${{ fromJson(steps.release.outputs.assets)[0].browser_download_url }}",
"changelog": "https://raw.githubusercontent.com/${{ github.repository }}/main/changelog.md"
}
EOF
- name: Commit and push updated files
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Stage everything: sha256 files, module.prop, update.Json
git add module.prop update.Json
git add $(git ls-files --others --exclude-standard | grep '\.sha256
git commit -m "chore: release ${{ steps.ver.outputs.tag }} [skip ci]"
git push
| grep -v '^\.github/')

Check failure on line 93 in .github/workflows/r.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/r.yml

Invalid workflow file

You have an error in your yaml syntax on line 93
git commit -m "chore: release ${{ steps.ver.outputs.tag }} [skip ci]"
git push