Browse Source

refactor(workflows): replace set-output with github env

pull/4175/head
Wing-Kam Wong 2 years ago
parent
commit
bcbd809cc7
  1. 14
      .github/workflows/release-docker.yml
  2. 4
      .github/workflows/release-draft.yml
  3. 4
      .github/workflows/release-executables.yml
  4. 29
      .github/workflows/release-nightly-dev.yml
  5. 24
      .github/workflows/release-nocodb.yml
  6. 36
      .github/workflows/release-pr.yml

14
.github/workflows/release-docker.yml

@ -60,10 +60,10 @@ jobs:
DOCKER_REPOSITORY=${DOCKER_REPOSITORY}-timely DOCKER_REPOSITORY=${DOCKER_REPOSITORY}-timely
fi fi
fi fi
echo "::set-output name=DOCKER_REPOSITORY::${DOCKER_REPOSITORY}" echo "DOCKER_REPOSITORY=${DOCKER_REPOSITORY}" >> $GITHUB_OUTPUT
echo "::set-output name=DOCKER_BUILD_TAG::${DOCKER_BUILD_TAG}" echo "DOCKER_BUILD_TAG=${DOCKER_BUILD_TAG}" >> $GITHUB_OUTPUT
echo ${DOCKER_REPOSITORY} echo DOCKER_REPOSITORY: ${DOCKER_REPOSITORY}
echo ${DOCKER_BUILD_TAG} echo DOCKER_BUILD_TAG: ${DOCKER_BUILD_TAG}
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -127,14 +127,14 @@ jobs:
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
context: ${{ env.working-directory }} context: ${{ env.working-directory }}
build-args: NC_VERSION=${{ steps.get-docker-repository.outputs.DOCKER_BUILD_TAG }} build-args: NC_VERSION=${{ env.DOCKER_BUILD_TAG }}
platforms: linux/amd64,linux/arm64,linux/arm/v7 platforms: linux/amd64,linux/arm64,linux/arm/v7
cache-from: type=local,src=/tmp/.buildx-cache cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new cache-to: type=local,dest=/tmp/.buildx-cache-new
push: true push: true
tags: | tags: |
nocodb/${{ steps.get-docker-repository.outputs.DOCKER_REPOSITORY }}:${{ steps.get-docker-repository.outputs.DOCKER_BUILD_TAG }} nocodb/${{ env.DOCKER_REPOSITORY }}:${{ env.DOCKER_BUILD_TAG }}
nocodb/${{ steps.get-docker-repository.outputs.DOCKER_REPOSITORY }}:latest nocodb/${{ env.DOCKER_REPOSITORY }}:latest
# Temp fix # Temp fix
# https://github.com/docker/build-push-action/issues/252 # https://github.com/docker/build-push-action/issues/252

4
.github/workflows/release-draft.yml

@ -53,7 +53,7 @@ jobs:
if [[ ${{ github.event.inputs.tagHeadSHA || inputs.tagHeadSHA }} == "Y" ]]; then if [[ ${{ github.event.inputs.tagHeadSHA || inputs.tagHeadSHA }} == "Y" ]]; then
TARGET_SHA=$(git rev-list -n 1 HEAD | tail -1) TARGET_SHA=$(git rev-list -n 1 HEAD | tail -1)
fi fi
echo "::set-output name=TARGET_SHA::${TARGET_SHA}" echo "TARGET_SHA=${TARGET_SHA}" >> $GITHUB_OUTPUT
echo "Setting TARGET_SHA: ${TARGET_SHA}" echo "Setting TARGET_SHA: ${TARGET_SHA}"
- name: Create tag - name: Create tag
uses: actions/github-script@v3 uses: actions/github-script@v3
@ -66,7 +66,7 @@ jobs:
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
ref: "refs/tags/${{ github.event.inputs.tag || inputs.tag }}", ref: "refs/tags/${{ github.event.inputs.tag || inputs.tag }}",
sha: "${{steps.get-sha.outputs.TARGET_SHA}}" sha: "${{ env.TARGET_SHA }}"
}) })
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:

4
.github/workflows/release-executables.yml

@ -194,7 +194,7 @@ jobs:
cp ./mac-dist/Noco-macos-x64 ./mac-dist/nocodb cp ./mac-dist/Noco-macos-x64 ./mac-dist/nocodb
tar -czf ./mac-dist/nocodb.tar.gz ./mac-dist/nocodb tar -czf ./mac-dist/nocodb.tar.gz ./mac-dist/nocodb
rm ./mac-dist/nocodb rm ./mac-dist/nocodb
echo "::set-output name=CHECKSUM::$(shasum -a 256 ./mac-dist/nocodb.tar.gz | awk '{print $1}')" echo "CHECKSUM=$(shasum -a 256 ./mac-dist/nocodb.tar.gz | awk '{print $1}')" >> $GITHUB_OUTPUT
id: compress id: compress
@ -240,7 +240,7 @@ jobs:
desc "NocoDB : Opensource smart spreadsheet" desc "NocoDB : Opensource smart spreadsheet"
homepage "https://github.com/nocodb/nocodb" homepage "https://github.com/nocodb/nocodb"
url "https://github.com/nocodb/nocodb/releases/download/${{ github.event.inputs.tag || inputs.tag }}/nocodb.tar.gz" url "https://github.com/nocodb/nocodb/releases/download/${{ github.event.inputs.tag || inputs.tag }}/nocodb.tar.gz"
sha256 "${{ steps.compress.outputs.CHECKSUM }}" sha256 "${{ env.CHECKSUM }}"
license "MIT" license "MIT"
version "${{ github.event.inputs.tag || inputs.tag }}" version "${{ github.event.inputs.tag || inputs.tag }}"

29
.github/workflows/release-nightly-dev.yml

@ -26,24 +26,19 @@ jobs:
if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
IS_DAILY='N' IS_DAILY='N'
fi fi
echo "::set-output name=NIGHTLY_BUILD_TAG::${TAG_NAME}" echo "NIGHTLY_BUILD_TAG=${TAG_NAME}" >> $GITHUB_OUTPUT
echo "::set-output name=IS_DAILY::${IS_DAILY}" echo "IS_DAILY=${IS_DAILY}" >> $GITHUB_OUTPUT
echo "::set-output name=CURRENT_VERSION::${CURRENT_VERSION}" echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_OUTPUT
- name: verify-tag # verify
run: | echo NIGHTLY_BUILD_TAG: ${{ env.NIGHTLY_BUILD_TAG }}
echo ${{ steps.tag-step.outputs.NIGHTLY_BUILD_TAG }} echo IS_DAILY: ${{ env.IS_DAILY }}
echo ${{ steps.tag-step.outputs.IS_DAILY }} echo CURRENT_VERSION: ${{ env.CURRENT_VERSION }}
echo ${{ steps.tag-step.outputs.CURRENT_VERSION }}
outputs:
nightly_build_tag: ${{ steps.tag-step.outputs.NIGHTLY_BUILD_TAG }}
is_daily: ${{ steps.tag-step.outputs.IS_DAILY }}
current_version: ${{ steps.tag-step.outputs.CURRENT_VERSION }}
# Build frontend and backend and publish to npm # Build frontend and backend and publish to npm
release-npm: release-npm:
needs: set-tag needs: set-tag
uses: ./.github/workflows/release-npm.yml uses: ./.github/workflows/release-npm.yml
with: with:
tag: ${{ needs.set-tag.outputs.nightly_build_tag }} tag: ${{ env.NIGHTLY_BUILD_TAG }}
targetEnv: 'DEV' targetEnv: 'DEV'
secrets: secrets:
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}" NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
@ -53,7 +48,7 @@ jobs:
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:
tag: ${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.nightly_build_tag }} tag: ${{ env.CURRENT_VERSION }}-${{ env.NIGHTLY_BUILD_TAG }}
secrets: secrets:
NC_GITHUB_TOKEN: "${{ secrets.NC_GITHUB_TOKEN }}" NC_GITHUB_TOKEN: "${{ secrets.NC_GITHUB_TOKEN }}"
@ -62,10 +57,10 @@ jobs:
needs: [set-tag, release-npm] needs: [set-tag, release-npm]
uses: ./.github/workflows/release-docker.yml uses: ./.github/workflows/release-docker.yml
with: with:
currentVersion: ${{ needs.set-tag.outputs.current_version }} currentVersion: ${{ env.CURRENT_VERSION }}
tag: ${{ needs.set-tag.outputs.nightly_build_tag }} tag: ${{ env.NIGHTLY_BUILD_TAG }}
targetEnv: 'DEV' targetEnv: 'DEV'
isDaily: ${{ needs.set-tag.outputs.is_daily }} isDaily: ${{ env.IS_DAILY }}
secrets: secrets:
DOCKERHUB_USERNAME: "${{ secrets.DOCKERHUB_USERNAME }}" DOCKERHUB_USERNAME: "${{ secrets.DOCKERHUB_USERNAME }}"
DOCKERHUB_TOKEN: "${{ secrets.DOCKERHUB_TOKEN }}" DOCKERHUB_TOKEN: "${{ secrets.DOCKERHUB_TOKEN }}"

24
.github/workflows/release-nocodb.yml

@ -25,9 +25,6 @@ jobs:
process-input: process-input:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: validate-branch needs: validate-branch
outputs:
target_tag: ${{ steps.process-input.outputs.target_tag }}
prev_tag: ${{ steps.process-input.outputs.prev_tag }}
steps: steps:
- id: process-input - id: process-input
name: process-input name: process-input
@ -47,18 +44,15 @@ jobs:
echo target version: ${TARGET_TAG} echo target version: ${TARGET_TAG}
echo previous version: ${PREV_TAG} echo previous version: ${PREV_TAG}
echo "::set-output name=target_tag::${TARGET_TAG}" echo "TARGET_TAG=${TARGET_TAG}" >> $GITHUB_OUTPUT
echo "::set-output name=prev_tag::${PREV_TAG}" echo "PREV_TAG=${PREV_TAG}" >> $GITHUB_OUTPUT
- name: Verify
run : |
echo ${{ steps.process-input.outputs.target_tag }}
# Merge develop to master # Merge develop to master
pr-to-master: pr-to-master:
needs: process-input needs: process-input
uses: ./.github/workflows/pr-to-master.yml uses: ./.github/workflows/pr-to-master.yml
with: with:
tag: ${{ needs.process-input.outputs.target_tag }} tag: ${{ env.TARGET_TAG }}
targetEnv: ${{ github.event.inputs.targetEnv || 'PROD' }} targetEnv: ${{ github.event.inputs.targetEnv || 'PROD' }}
# Build, install, publish frontend and backend to npm # Build, install, publish frontend and backend to npm
@ -66,7 +60,7 @@ jobs:
needs: [pr-to-master, process-input] needs: [pr-to-master, process-input]
uses: ./.github/workflows/release-npm.yml uses: ./.github/workflows/release-npm.yml
with: with:
tag: ${{ needs.process-input.outputs.target_tag }} tag: ${{ env.TARGET_TAG }}
targetEnv: ${{ github.event.inputs.targetEnv || 'PROD' }} targetEnv: ${{ github.event.inputs.targetEnv || 'PROD' }}
secrets: secrets:
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}" NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
@ -76,8 +70,8 @@ jobs:
needs: [release-npm, process-input] needs: [release-npm, process-input]
uses: ./.github/workflows/release-draft.yml uses: ./.github/workflows/release-draft.yml
with: with:
tag: ${{ needs.process-input.outputs.target_tag }} tag: ${{ env.TARGET_TAG }}
prev_tag: ${{ needs.process-input.outputs.prev_tag }} prev_tag: ${{ env.PREV_TAG }}
tagHeadSHA: 'N' tagHeadSHA: 'N'
secrets: secrets:
NC_GITHUB_TOKEN: "${{ secrets.NC_GITHUB_TOKEN }}" NC_GITHUB_TOKEN: "${{ secrets.NC_GITHUB_TOKEN }}"
@ -88,7 +82,7 @@ jobs:
uses: ./.github/workflows/release-docker.yml uses: ./.github/workflows/release-docker.yml
with: with:
currentVersion: 'N/A' currentVersion: 'N/A'
tag: ${{ needs.process-input.outputs.target_tag }} tag: ${{ env.TARGET_TAG }}
targetEnv: ${{ github.event.inputs.targetEnv || 'PROD' }} targetEnv: ${{ github.event.inputs.targetEnv || 'PROD' }}
secrets: secrets:
DOCKERHUB_USERNAME: "${{ secrets.DOCKERHUB_USERNAME }}" DOCKERHUB_USERNAME: "${{ secrets.DOCKERHUB_USERNAME }}"
@ -99,7 +93,7 @@ jobs:
needs: [release-draft-note, process-input] needs: [release-draft-note, process-input]
uses: ./.github/workflows/release-executables.yml uses: ./.github/workflows/release-executables.yml
with: with:
tag: ${{ needs.process-input.outputs.target_tag }} tag: ${{ env.TARGET_TAG }}
secrets: secrets:
NC_GITHUB_TOKEN: "${{ secrets.NC_GITHUB_TOKEN }}" NC_GITHUB_TOKEN: "${{ secrets.NC_GITHUB_TOKEN }}"
@ -109,7 +103,7 @@ jobs:
uses: ./.github/workflows/release-close-issue.yml uses: ./.github/workflows/release-close-issue.yml
with: with:
issue_label: '🚀 Status: Ready for Next Release' issue_label: '🚀 Status: Ready for Next Release'
version: ${{ needs.process-input.outputs.target_tag }} version: ${{ env.TARGET_TAG }}
# Publish Docs # Publish Docs
publish-docs: publish-docs:

36
.github/workflows/release-pr.yml

@ -35,15 +35,11 @@ jobs:
CURRENT_VERSION=$(basename $(curl -fs -o/dev/null -w %{redirect_url} https://github.com/nocodb/nocodb/releases/latest)) CURRENT_VERSION=$(basename $(curl -fs -o/dev/null -w %{redirect_url} https://github.com/nocodb/nocodb/releases/latest))
# Construct tag name # Construct tag name
TAG_NAME=pr-${PR_NUMBER}-${CURRENT_DATE}-${CURRENT_TIME} TAG_NAME=pr-${PR_NUMBER}-${CURRENT_DATE}-${CURRENT_TIME}
echo "::set-output name=TARGET_TAG::${TAG_NAME}" echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_OUTPUT
echo "::set-output name=CURRENT_VERSION::${CURRENT_VERSION}" echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_OUTPUT
- name: verify-tag # Verify
run: | echo env.TARGET_TAG: ${{ env.TARGET_TAG }}
echo ${{ steps.tag-step.outputs.TARGET_TAG }} echo env.CURRENT_VERSION: ${{ env.CURRENT_VERSION }}
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 # Build, install, publish frontend and backend to npm
release-npm: release-npm:
@ -51,7 +47,7 @@ jobs:
needs: [set-tag] needs: [set-tag]
uses: ./.github/workflows/release-npm.yml uses: ./.github/workflows/release-npm.yml
with: with:
tag: ${{ needs.set-tag.outputs.target_tag }} tag: ${{ env.TARGET_TAG }}
targetEnv: 'DEV' targetEnv: 'DEV'
secrets: secrets:
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}" NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
@ -62,8 +58,8 @@ jobs:
needs: [release-npm, set-tag] needs: [release-npm, set-tag]
uses: ./.github/workflows/release-docker.yml uses: ./.github/workflows/release-docker.yml
with: with:
currentVersion: ${{ needs.set-tag.outputs.current_version }} currentVersion: ${{ env.CURRENT_VERSION }}
tag: ${{ needs.set-tag.outputs.target_tag }} tag: ${{ env.TARGET_TAG }}
targetEnv: 'DEV' targetEnv: 'DEV'
isDaily: 'N' isDaily: 'N'
secrets: secrets:
@ -76,7 +72,7 @@ jobs:
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:
tag: ${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }} tag: ${{ env.CURRENT_VERSION }}-${{ env.TARGET_TAG }}
secrets: secrets:
NC_GITHUB_TOKEN: "${{ secrets.NC_GITHUB_TOKEN }}" NC_GITHUB_TOKEN: "${{ secrets.NC_GITHUB_TOKEN }}"
@ -91,7 +87,7 @@ jobs:
body: | body: |
The PR changes have been deployed. Please run the following command to verify: The PR changes have been deployed. Please run the following command to verify:
``` ```
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:${{ env.CURRENT_VERSION }}-${{ env.TARGET_TAG }}
``` ```
# Add a comment for PR executable build # Add a comment for PR executable build
@ -108,24 +104,24 @@ jobs:
#### MacOS #### MacOS
```bash ```bash
mkdir -p ./${{ needs.set-tag.outputs.current_version }}/${{ needs.set-tag.outputs.target_tag }} && cd "$_" \ mkdir -p ./${{ env.CURRENT_VERSION }}/${{ env.TARGET_TAG }} && cd "$_" \
&& curl http://dl.nocodb.com/${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}/Noco-macos-arm64 -o noco -L \ && curl http://dl.nocodb.com/${{ env.CURRENT_VERSION }}-${{ env.TARGET_TAG }}/Noco-macos-arm64 -o noco -L \
&& chmod +x noco \ && chmod +x noco \
&& ./noco && ./noco
``` ```
#### Linux #### Linux
```bash ```bash
mkdir -p ./${{ needs.set-tag.outputs.current_version }}/${{ needs.set-tag.outputs.target_tag }} && cd "$_" \ mkdir -p ./${{ env.CURRENT_VERSION }}/${{ env.TARGET_TAG }} && cd "$_" \
&& curl http://dl.nocodb.com/${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}/Noco-linux-x64 -o noco -L \ && curl http://dl.nocodb.com/${{ env.CURRENT_VERSION }}-${{ env.TARGET_TAG }}/Noco-linux-x64 -o noco -L \
&& chmod +x noco \ && chmod +x noco \
&& ./noco && ./noco
``` ```
#### Windows #### Windows
```bash ```bash
iwr http://dl.nocodb.com/${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}/Noco-win-arm64.exe iwr http://dl.nocodb.com/${{ env.CURRENT_VERSION }}-${{ env.TARGET_TAG }}/Noco-win-arm64.exe
.\Noco-win-arm64.exe .\Noco-win-arm64.exe
``` ```
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/${{ env.CURRENT_VERSION }}-${{ env.TARGET_TAG }})

Loading…
Cancel
Save