Browse Source

refactor: release-pr

pull/2541/head
Wing-Kam Wong 2 years ago
parent
commit
eacd1a848a
  1. 40
      .github/workflows/release-pr.yml

40
.github/workflows/release-pr.yml

@ -13,22 +13,10 @@ on:
- "packages/nc-plugin/**" - "packages/nc-plugin/**"
- "packages/nocodb/**" - "packages/nocodb/**"
jobs: jobs:
# Validate Branch
validate-branch:
if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false }}
runs-on: ubuntu-latest
steps:
- run: |
if [[ ${{ github.base_ref }} != 'develop' ]]; then
echo "PR Release only runs on develop as a base branch"
exit 1
fi
# enrich tag for pr release # enrich tag for pr release
set-tag: set-tag:
if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false }} if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }}
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
needs: [validate-branch]
steps: steps:
- name: set-tag - name: set-tag
id: tag-step id: tag-step
@ -54,7 +42,7 @@ jobs:
# Build, install, publish frontend and backend to npm # Build, install, publish frontend and backend to npm
release-npm: release-npm:
if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false }} if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }}
needs: [set-tag] needs: [set-tag]
uses: ./.github/workflows/release-npm.yml uses: ./.github/workflows/release-npm.yml
with: with:
@ -65,7 +53,7 @@ jobs:
# Build docker image and push to docker hub # Build docker image and push to docker hub
release-docker: release-docker:
if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false }} if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }}
needs: [release-npm, set-tag] needs: [release-npm, set-tag]
uses: ./.github/workflows/release-docker.yml uses: ./.github/workflows/release-docker.yml
with: with:
@ -79,6 +67,7 @@ jobs:
# Build executables and publish to GitHub # Build executables and publish to GitHub
release-executables: release-executables:
if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }}
needs: [set-tag, release-npm] needs: [set-tag, release-npm]
uses: ./.github/workflows/release-timely-executables.yml uses: ./.github/workflows/release-timely-executables.yml
with: with:
@ -86,15 +75,9 @@ jobs:
secrets: secrets:
NC_GITHUB_TOKEN: "${{ secrets.NC_GITHUB_TOKEN }}" NC_GITHUB_TOKEN: "${{ secrets.NC_GITHUB_TOKEN }}"
# leave-comment: # Add a comment for PR docker build
# runs-on: 'ubuntu-latest'
# needs: [release-docker, set-tag]
# steps:
# - run: |
# echo docker run -d -p 8888:8080 nocodb/nocodb-timely:${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}
leave-comment: leave-comment:
if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false }} if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }}
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
needs: [release-docker, set-tag] needs: [release-docker, set-tag]
steps: steps:
@ -106,8 +89,9 @@ jobs:
docker run -d -p 8888:8080 nocodb/nocodb-timely:${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }} docker run -d -p 8888:8080 nocodb/nocodb-timely:${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}
``` ```
# Add a comment for PR executable build
leave-executable-comment: leave-executable-comment:
if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false }} if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }}
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
needs: [release-executables, set-tag] needs: [release-executables, set-tag]
steps: steps:
@ -140,11 +124,3 @@ jobs:
``` ```
For executables visit [here](https://github.com/nocodb/nocodb-timely/releases/tag/${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}) For executables visit [here](https://github.com/nocodb/nocodb-timely/releases/tag/${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }})
# if-merged:
# if: github.event.pull_request.merged == true
# runs-on: ubuntu-latest
# steps:
# - run: |
# echo The PR was merged

Loading…
Cancel
Save