automatic update #34
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: automatic update | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
- main | |
jobs: | |
skip: | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "[Skip CI] ${{ contains(github.event.head_commit.message, '[skip ci]') }}" | |
release: | |
name: release | |
runs-on: ubuntu-latest | |
if: contains(github.event.head_commit.message, '[skip ci]') == false | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'adopt' | |
java-version: '8' | |
- name: setup Swift | |
uses: swift-actions/setup-swift@v1 | |
- name: cache packages | |
uses: actions/cache@v3 | |
with: | |
path: ./.build | |
key: ${{ runner.os }}-${{ hashFiles('./Package.resolved') }} | |
- name: build | |
run: sh ./generate.sh | |
- name: Check diff | |
run: | | |
git add . | |
DIFFS=`git diff --name-only HEAD` | |
echo $DIFFS | |
if [ "$DIFFS" = '' ]; then | |
echo "HAS_DIFF=false" >> $GITHUB_ENV | |
else | |
echo "HAS_DIFF=true" >> $GITHUB_ENV | |
fi | |
git reset HEAD | |
- name: git commit | |
if: env.HAS_DIFF == 'true' | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
git add . | |
git commit -m "CI: regenerate [ci skip]" --author="ras0q <[email protected]>" | |
- name: git push | |
if: env.HAS_DIFF == 'true' | |
uses: ad-m/github-push-action@a3fd843e49cd58d296bdd2431c4853569a1b900f | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |