feat(ci): refactor ci auto commit
This commit is contained in:
51
.github/workflows/build.yml
vendored
51
.github/workflows/build.yml
vendored
@@ -1,51 +0,0 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Clone lush
|
||||
run: |
|
||||
git clone --depth 1 https://github.com/rktjmp/lush.nvim ~/.local/share/nvim/site/pack/zenbones/start/lush.nvim
|
||||
git clone --depth 1 https://github.com/rktjmp/shipwright.nvim ~/.local/share/nvim/site/pack/zenbones/start/shipwright.nvim
|
||||
|
||||
- uses: rhysd/action-setup-vim@v1
|
||||
with:
|
||||
neovim: true
|
||||
version: stable
|
||||
|
||||
- name: Setup git
|
||||
run: |
|
||||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
printf 'BUILD_BRANCH=bot/build/%s\n' ${GITHUB_REF#refs/heads/} >> $GITHUB_ENV
|
||||
|
||||
- name: Checkout to build branch
|
||||
run: git checkout -b ${BUILD_BRANCH}
|
||||
|
||||
- name: Run builder script
|
||||
run: |
|
||||
mkdir -p autoload/lightline/colorscheme colors/ lua/lualine extras
|
||||
make
|
||||
|
||||
- name: Create PR
|
||||
run: |
|
||||
if ! [[ -z $(git status -s) ]]; then
|
||||
git add autoload/lightline/colorscheme/ colors/ lua/lualine/ extras/
|
||||
git commit -m "chore: rebuild artifacts"
|
||||
git push --force https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} ${BUILD_BRANCH}
|
||||
gh pr create --fill --base ${GITHUB_REF#refs/heads/} --head ${BUILD_BRANCH} || true
|
||||
fi
|
||||
116
.github/workflows/ci.yml
vendored
116
.github/workflows/ci.yml
vendored
@@ -2,9 +2,7 @@ name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, dev]
|
||||
pull_request:
|
||||
branches: [main, dev]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
@@ -16,3 +14,117 @@ jobs:
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
args: lua
|
||||
docs:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.ref == 'refs/heads/main' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: panvimdoc
|
||||
uses: kdheepak/panvimdoc@main
|
||||
with:
|
||||
vimdoc: zenbones
|
||||
pandoc: doc/zenbones.md
|
||||
description: "A collection of contrast-based vim/neovim colorschemes"
|
||||
version: "Vim 8.1 / Nvim v0.8.0"
|
||||
treesitter: true
|
||||
- name: Push changes
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: "chore(build): auto-generate vimdoc"
|
||||
commit_user_name: "github-actions[bot]"
|
||||
commit_user_email: "github-actions[bot]@users.noreply.github.com"
|
||||
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.ref == 'refs/heads/main' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Clone lush
|
||||
run: |
|
||||
git clone --depth 1 https://github.com/rktjmp/lush.nvim ~/.local/share/nvim/site/pack/zenbones/start/lush.nvim
|
||||
git clone --depth 1 https://github.com/rktjmp/shipwright.nvim ~/.local/share/nvim/site/pack/zenbones/start/shipwright.nvim
|
||||
|
||||
- uses: rhysd/action-setup-vim@v1
|
||||
with:
|
||||
neovim: true
|
||||
version: stable
|
||||
|
||||
- name: Setup git
|
||||
run: |
|
||||
printf 'BUILD_BRANCH=bot/build/%s\n' ${GITHUB_REF#refs/heads/} >> $GITHUB_ENV
|
||||
|
||||
- name: Checkout to build branch
|
||||
run: git checkout -b ${BUILD_BRANCH}
|
||||
|
||||
- name: Run builder script
|
||||
run: |
|
||||
mkdir -p autoload/lightline/colorscheme colors/ lua/lualine extras
|
||||
make
|
||||
|
||||
- name: Push changes
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: "chore(build): rebuild artifacts"
|
||||
commit_user_name: "github-actions[bot]"
|
||||
commit_user_email: "github-actions[bot]@users.noreply.github.com"
|
||||
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
|
||||
|
||||
format:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.ref == 'refs/heads/main' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup git
|
||||
run: |
|
||||
printf 'STYLE_BRANCH=bot/style/%s\n' ${GITHUB_REF#refs/heads/} >> $GITHUB_ENV
|
||||
|
||||
- name: Checkout to style branch
|
||||
run: git checkout -b ${STYLE_BRANCH}
|
||||
|
||||
- uses: JohnnyMorganz/stylua-action@v2
|
||||
with:
|
||||
version: latest
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
args: --config-path=.stylua.toml lua/
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
- name: Apply prettier
|
||||
run: |
|
||||
npm install -g prettier
|
||||
prettier --write **/*.md
|
||||
|
||||
- name: Push changes
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: "chore(build): format"
|
||||
commit_user_name: "github-actions[bot]"
|
||||
commit_user_email: "github-actions[bot]@users.noreply.github.com"
|
||||
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
|
||||
|
||||
release:
|
||||
name: release
|
||||
if: ${{ github.ref == 'refs/heads/main' }}
|
||||
needs:
|
||||
- docs
|
||||
- build
|
||||
- format
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: google-github-actions/release-please-action@v3
|
||||
id: release
|
||||
with:
|
||||
release-type: simple
|
||||
package-name: zenbones.nvim
|
||||
- uses: actions/checkout@v3
|
||||
- name: tag stable versions
|
||||
if: ${{ steps.release.outputs.release_created }}
|
||||
run: |
|
||||
git config user.name github-actions[bot]
|
||||
git config user.email github-actions[bot]@users.noreply.github.com
|
||||
git remote add gh-token "https://${{ secrets.GITHUB_TOKEN }}@github.com/google-github-actions/release-please-action.git"
|
||||
git tag -d stable || true
|
||||
git push origin :stable || true
|
||||
git tag -a stable -m "Last Stable Release"
|
||||
git push origin stable
|
||||
|
||||
44
.github/workflows/doc.yml
vendored
44
.github/workflows/doc.yml
vendored
@@ -1,44 +0,0 @@
|
||||
name: Doc
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
vimdocgen:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup git
|
||||
run: |
|
||||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
printf 'VIMDOC_BRANCH=bot/vimdoc/%s\n' ${GITHUB_REF#refs/heads/} >> $GITHUB_ENV
|
||||
|
||||
- name: Checkout to vimdoc branch
|
||||
run: git checkout -b ${VIMDOC_BRANCH}
|
||||
|
||||
- name: panvimdoc
|
||||
uses: kdheepak/panvimdoc@v3.0.5
|
||||
with:
|
||||
# Output vimdoc project name
|
||||
vimdoc: zenbones
|
||||
pandoc: doc/zenbones.md
|
||||
description: "A collection of contrast-based vim/neovim colorschemes"
|
||||
version: "Vim 8.1 / Nvim v0.8.0"
|
||||
treesitter: true
|
||||
- name: Create PR
|
||||
run: |
|
||||
if ! [[ -z $(git status -s) ]]; then
|
||||
git add doc/zenbones.txt
|
||||
git commit -m "chore: generated vimdoc"
|
||||
git push --force https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} ${VIMDOC_BRANCH}
|
||||
gh pr create --fill --base ${GITHUB_REF#refs/heads/} --head ${VIMDOC_BRANCH} || true
|
||||
fi
|
||||
Reference in New Issue
Block a user