mirror of https://github.com/nocodb/nocodb
Wing-Kam Wong
3 years ago
6 changed files with 102 additions and 8 deletions
@ -0,0 +1,90 @@
|
||||
name: 'PR Release' |
||||
|
||||
on: |
||||
pull_request: |
||||
types: [ |
||||
opened, # pull request is created |
||||
reopened, # closed pull request is reopened |
||||
synchronize # commit(s) pushed to the pull request |
||||
] |
||||
paths: |
||||
- "packages/nocodb-sdk/**" |
||||
- "packages/nc-gui/**" |
||||
- "packages/nc-plugin/**" |
||||
- "packages/nocodb/**" |
||||
jobs: |
||||
# Validate Branch |
||||
validate-branch: |
||||
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 |
||||
set-tag: |
||||
runs-on: 'ubuntu-latest' |
||||
needs: [validate-branch] |
||||
steps: |
||||
- name: set-tag |
||||
id: tag-step |
||||
run: | |
||||
# Get current date |
||||
CURRENT_DATE=$(date +"%Y%m%d") |
||||
CURRENT_TIME=$(date +"%H%M") |
||||
# Get current PR number |
||||
PR_NUMBER=${{github.event.number}} |
||||
# Get current version |
||||
CURRENT_VERSION=$(basename $(curl -fs -o/dev/null -w %{redirect_url} https://github.com/nocodb/nocodb/releases/latest)) |
||||
# Construct tag name |
||||
TAG_NAME=pr-${PR_NUMBER}-${CURRENT_DATE}-${CURRENT_TIME} |
||||
echo "::set-output name=TARGET_TAG::${TAG_NAME}" |
||||
echo "::set-output name=CURRENT_VERSION::${CURRENT_VERSION}" |
||||
- name: verify-tag |
||||
run: | |
||||
echo ${{ steps.tag-step.outputs.TARGET_TAG }} |
||||
echo ${{ steps.tag-step.outputs.CURRENT_VERSION }} |
||||
outputs: |
||||
target_tag: ${{ steps.tag-step.outputs.TARGET_TAG }} |
||||
current_version: ${{ steps.tag-step.outputs.CURRENT_VERSION }} |
||||
|
||||
# Build, install, publish frontend and backend to npm |
||||
release-npm: |
||||
needs: [set-tag] |
||||
uses: ./.github/workflows/release-npm.yml |
||||
with: |
||||
tag: ${{ needs.set-tag.outputs.target_tag }} |
||||
targetEnv: 'DEV' |
||||
secrets: |
||||
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}" |
||||
|
||||
# Build docker image and push to docker hub |
||||
release-docker: |
||||
needs: [release-npm, set-tag] |
||||
uses: ./.github/workflows/release-docker.yml |
||||
with: |
||||
tag: ${{ needs.set-tag.outputs.target_tag }} |
||||
targetEnv: 'PR' |
||||
isDaily: 'N' |
||||
secrets: |
||||
DOCKERHUB_USERNAME: "${{ secrets.DOCKERHUB_USERNAME }}" |
||||
DOCKERHUB_TOKEN: "${{ secrets.DOCKERHUB_TOKEN }}" |
||||
|
||||
leave-comment: |
||||
needs: [release-docker, set-tag] |
||||
uses: peter-evans/commit-comment@v2 |
||||
with: |
||||
body: | |
||||
The PR changes have been deployed. Pleae run the following command to verify: |
||||
``` |
||||
docker run -d -p 8888:8080 nocodb-timely:${{ 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…
Reference in new issue