Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

ci: fix excluding setting #316

ci: fix excluding setting

ci: fix excluding setting #316

Workflow file for this run

name: ci
on:
push:
branches: [main, release]
pull_request:
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
plugin: ${{ steps.plugin.outputs.any_changed }}
server: ${{ steps.server.outputs.any_changed }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: changed files for plugin
id: plugin
uses: tj-actions/changed-files@v36
with:
files: |
plugin
.github/workflows/ci.yml
.github/workflows/ci-plugin.yml
.github/workflows/ci-plugin-version-update.yml
CHANGELOG.md
- name: changed files for server
id: server
uses: tj-actions/changed-files@v36
with:
files: |
server
.github/workflows/ci.yml
.github/workflows/ci-server.yml
.github/workflows/build-server.yml
.github/workflows/deploy-server-dev.yml
.github/workflows/deploy-server-prod.yml
ci-plugin:
needs: prepare
if: ${{ !failure() && needs.prepare.outputs.plugin == 'true' }}
uses: ./.github/workflows/ci-plugin.yml
ci-server:
needs: prepare
if: ${{ !failure() && needs.prepare.outputs.server == 'true' }}
uses: ./.github/workflows/ci-server.yml
ci:
runs-on: ubuntu-latest
needs:
- ci-plugin
- ci-server
if: '!failure()'
steps:
- run: echo OK
build-server:
needs: ci-server
if: ${{ success() && github.event_name == 'push' && github.ref_name == 'main' }}
uses: ./.github/workflows/build-server.yml
ci-collect-info:
name: Collect information
needs: ci
if: '!failure()'
runs-on: ubuntu-latest
outputs:
sha_short: ${{ steps.info.outputs.sha_short || 'blank' }}
new_tag: ${{ steps.info.outputs.new_tag || 'blank' }}
new_tag_short: ${{ steps.info.outputs.new_tag_short || 'blank' }}
name: ${{ steps.info.outputs.name || 'blank' }}
steps:
- name: checkout
uses: actions/checkout@v3
- name: Fetch tags
run: git fetch --prune --unshallow --tags
- name: Get info
id: info
# The tag name should be retrieved lazily, as tagging may be delayed.
env:
BRANCH: ${{github.ref_name}}
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
echo "BRANCH=$BRANCH"
if [[ "$BRANCH" = "release" ]]; then
TAG=$(git tag --points-at HEAD)
if [[ ! -z "$TAG" ]]; then
echo "::set-output name=new_tag::$TAG"
echo "::set-output name=new_tag_short::${TAG#v}"
else
echo "::set-output name=name::rc"
fi
else
echo "::set-output name=name::nightly"
fi
- name: Show info
env:
SHA_SHORT: ${{ steps.info.outputs.sha_short }}
NEW_TAG: ${{ steps.info.outputs.new_tag }}
NEW_TAG_SHORT: ${{ steps.info.outputs.new_tag_short }}
NAME: ${{ steps.info.outputs.name }}
run: echo "sha_short=$SHA_SHORT, new_tag=$NEW_TAG, new_tag_short=$NEW_TAG_SHORT, name=$NAME"
build-plugin:
needs:
- ci
- ci-plugin
- ci-collect-info
runs-on: ubuntu-latest
if: ${{!failure() && github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'release')}}
steps:
- name: Dispatch Plugin Build
uses: benc-uk/workflow-dispatch@v1
with:
workflow: build-plugin.yml
inputs: '{
"sha_short": "${{ needs.ci-collect-info.outputs.sha_short }}",
"new_tag": "${{ needs.ci-collect-info.outputs.new_tag }}",
"new_tag_short": "${{ needs.ci-collect-info.outputs.new_tag_short }}",
"name": "${{ needs.ci-collect-info.outputs.name }}",
"sha": "${{ github.sha }}"
}'
deploy-server-dev:
needs: build-server
runs-on: ubuntu-latest
steps:
- name: Dispatch deployment
uses: peter-evans/repository-dispatch@v2
with:
event-type: deploy-server-dev