From e5871dff4c63ce948464a0db7a354c6e004bbf06 Mon Sep 17 00:00:00 2001 From: Estrella Pan <33726646+EstrellaXD@users.noreply.github.com> Date: Tue, 29 Aug 2023 13:53:21 +0800 Subject: [PATCH] fix: ci problem. (#438) * ci: test new jobs. * ci: test new jobs. * ci: fix shell problem. * ci: fix shell problem. --- .github/workflows/build.yml | 58 ++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6a38ad90..31ab79ce 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,35 +27,41 @@ jobs: version-info: runs-on: ubuntu-latest steps: - - name: Test - if: | - github.event_name == 'pull_request' && - github.event.pull_request.merged == false + - name: If release + id: release run: | - echo "release=0" >> $GITHUB_OUTPUT - echo "dev=1" >> $GITHUB_OUTPUT - echo "version=Test" >> $GITHUB_OUTPUT - - name: Normal Release, generate tag. - if: | - github.event_name == 'pull_request' && - github.event.pull_request.merged == true + if [[${{ github.event_name }}== 'pull_request'] && [${{ github.event.pull_request.merged }} == true]] || \ + [[ ${{ github.event_name }} == 'push' && (${{ github.ref }} == *'alpha'* || ${{ github.ref }} == *'beta'*) ]]; then + echo "release=1" >> $GITHUB_OUTPUT + else + echo "release=0" >> $GITHUB_OUTPUT + fi + - name: If dev + id: dev run: | - git config --local user.email - git config --local user.name "github-actions" - git tag -a ${{ github.event.pull_request.title }} -m ${{ github.event.pull_request.body }} - git push origin ${{ github.event.pull_request.title }} - echo "release=1" >> $GITHUB_OUTPUT - echo "dev=0" >> $GITHUB_OUTPUT - echo "version=${{ github.event.pull_request.title }}" >> $GITHUB_OUTPUT - - name: Dev Release - if: | - github.event_name == 'push' && - contains(github.ref, 'alpha') || - contains(github.ref, 'beta') + if [ ${{ github.ref }} == *'alpha'* || ${{ github.ref }} == *'beta'* ]; then + echo "dev=1" >> $GITHUB_OUTPUT + else + echo "dev=0" >> $GITHUB_OUTPUT + fi + - name: Check version + id: version run: | - echo "release=1" >> $GITHUB_OUTPUT - echo "dev=1" >> $GITHUB_OUTPUT - echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT + if [${{ github.event_name }} == 'pull_request' && ${{ github.event.pull_request.merged }} == true]; then + echo "version=${{ github.event.pull_request.title }}" >> $GITHUB_OUTPUT + git config --local user.email + git config --local user.name "github-actions" + git tag -a ${{ github.event.pull_request.title }} -m ${{ github.event.pull_request.body }} + git push origin ${{ github.event.pull_request.title }} + elif [[ ${{ github.event_name }} == 'push' && (${{ github.ref }} == *'alpha'* || ${{ github.ref }} == *'beta'*) ]]; then + echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT + else + echo "version=Test" >> $GITHUB_OUTPUT + fi + outputs: + release: ${{ steps.release.outputs.release }} + dev: ${{ steps.dev.outputs.dev }} + version: ${{ steps.version.outputs.version }} build-webui: runs-on: ubuntu-latest