PromucFlow_constructor/.github/workflows/github-release.yml
Shrikant Sharat Kandula c6c128270c
Include version information when building Docker images for server and client (#2200)
* Include version information in backend builds

* Enable manual trigger of server workflow

* Add a dummy input field for manual trigger

* Fix secret checking in github actions

* Disable cron scheduling of sync job

* Build docker image on pushing a version tag

* Fix duplicated id and invalid id in release workflow

* Don't try to login to Docker

* Avoid download progress outputs from Maven

* Add version information for building client

* Calculate version number only once

* Enable push to DockerHub after building images

* Use Docker username from GitHub secrets

* Fix Docker username in tags when building image

* Use different secret for org name

* Minor refactoring in server workflow

* Update client build workflow to use version

* Enable manual triggering of client workflow

* Set snapshot version for server builds

* Push to docker for all branches (temp)

* Undo temp change to push all branches to DockerHub

* Use Docker org from secrets in client.yml

* Fix missing version reference in client.yml

* Remove debug command in dockerfile

* Save release notes in a resource file in Docker image

* Fix query serialization to get release notes

* Get releases of current repo instead of hard-coded repo

* Fix variable quoting for repo variables

* Exclude draft and prerelease nodes from image

* Fix call to any in release notes processor

* Fix syntax error in release notes script

* Implement API to get new release count and info

* Add missing ReleaseNotes component

* Have the release workflow run after a release is created

* Build server after generating release notes

* Change release trigger to "released"

* Change release trigger to "published"

* Change release trigger to released, edited and deleted

* Use JS script to get release notes, take 1

* Filter drafts and prereleases in script

* Fix syntax error in ES6

* Write release notes to file

* Create parent directory before writing release notes

* Log cwd in release notes script

* Log pwd along with release-notes content

* Handle case where working directory is incorrect

* Remove shell based release notes generator

* Don't show error when Sentry config is missing

* Check for sentry auth token to enable Sentry

* Carry build's exit code over to CI

* Mark out build result and add a note about it

* Add a small test to verify new versions computation

* Remove incorrect test assertion

* Remove generation of release notes file

* Connect to cloud services to fetch release notes data

* Fix missing runner for test class

* Handle missing cloud_services base URL

* Fix test failures due to missing mocks

* Enable sync-ee cron job

* Revert build.sh as there's no real change

* Add API to update release notes viewed version for users

* Fix prettier line-length errors

* Create UserData model for info unrelated to auth

* Fix field name calls

* Ensure we have a userId before setting userData

* Add tests for setting version number in UserData

* Include instanceId when fetching release notes
2021-01-12 18:15:15 +05:30

154 lines
5.4 KiB
YAML

name: Appsmith Github Release Workflow
# This workflow builds Docker images for server and client, and then pushes them to Docher Hub.
# The docker-tag with which this push happens in the release tag (e.g., v1.2.3 etc.).
# In addition to the above tag, unless the git-tag matches `*beta*`, we also push to the `latest` docker-tag.
# This workflow does NOT run tests.
# This workflow is automatically triggered when a relese is created on GitHub.
on:
# Ref: <https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#release>.
release:
types:
# Unlike the `released` event, the `published` event triggers for pre-releases as well.
- released
jobs:
prelude:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.get_version.outputs.tag }}
version: ${{ steps.get_version.outputs.version }}
is_beta: ${{ steps.get_version.outputs.is_beta }}
steps:
- name: Environment details
run: |
echo "PWD: $PWD"
echo "GITHUB_REF: $GITHUB_REF"
echo "GITHUB_SHA: $GITHUB_SHA"
echo "GITHUB_EVENT_NAME: $GITHUB_EVENT_NAME"
- name: Get the version
id: get_version
run: |
tag="${GITHUB_REF#refs/tags/}"
echo "::set-output name=version::${tag#v}"
echo "::set-output name=tag::$tag"
if [[ $tag == *"beta"* ]]; then
echo "::set-output name=is_beta::true"
else
echo "::set-output name=is_beta::false"
fi
build-client:
needs:
- prelude
runs-on: ubuntu-latest
defaults:
run:
working-directory: app/client
steps:
# Checkout the code
- uses: actions/checkout@v2
- name: Use Node.js 10.16.3
uses: actions/setup-node@v1
with:
node-version: "10.16.3"
# Retrieve npm dependencies from cache. After a successful run, these dependencies are cached again
- name: Cache npm dependencies
uses: actions/cache@v2
env:
cache-name: cache-yarn-dependencies
with:
# npm dependencies are stored in `~/.m2` on Linux/macOS
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
# Install all the dependencies
- name: Install dependencies
run: yarn install
- name: Create the bundle
env:
REACT_APP_ENVIRONMENT: 'PRODUCTION'
REACT_APP_FUSIONCHARTS_LICENSE_KEY: '${{ secrets.APPSMITH_FUSIONCHARTS_LICENSE_KEY }}'
REACT_APP_SEGMENT_CE_KEY: '${{ secrets.APPSMITH_SEGMENT_CE_KEY }}'
REACT_APP_VERSION_ID: '${{ needs.prelude.outputs.version }}'
run: 'REACT_APP_VERSION_RELEASE_DATE="$(date +%Y-%m-%d)" yarn build'
# Build Docker image and push to Docker Hub
- name: Push production image to Docker Hub with commit tag
run: |
docker build -t ${{ secrets.DOCKER_HUB_ORGANIZATION }}/appsmith-editor:${{needs.prelude.outputs.tag}} .
# Only build & tag with latest if the tag doesn't contain beta
if [[ ! ${{needs.prelude.outputs.tag}} == *"beta"* ]]; then
docker build -t ${{ secrets.DOCKER_HUB_ORGANIZATION }}/appsmith-editor:latest .
fi
echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
docker push ${{ secrets.DOCKER_HUB_ORGANIZATION }}/appsmith-editor
build-server:
needs:
- prelude
runs-on: ubuntu-latest
defaults:
run:
working-directory: app/server
steps:
- name: Checkout the code
uses: actions/checkout@v2
# Setup Java
- name: Set up JDK 1.11
uses: actions/setup-java@v1
with:
java-version: 1.11
# Retrieve maven dependencies from cache. After a successful run, these dependencies are cached again
- name: Cache maven dependencies
uses: actions/cache@v2
env:
cache-name: cache-maven-dependencies
with:
# maven dependencies are stored in `~/.m2` on Linux/macOS
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
# Build the code
- name: Build without running any tests
run: |
mvn --batch-mode versions:set \
-DnewVersion=${{ needs.prelude.outputs.version }} \
-DgenerateBackupPoms=false \
-DprocessAllModules=true
mvn --batch-mode package -DskipTests
# Build Docker image and push to Docker Hub
- name: Push image to Docker Hub
run: |
docker build --build-arg APPSMITH_SEGMENT_CE_KEY=${{ secrets.APPSMITH_SEGMENT_CE_KEY }} -t ${{ secrets.DOCKER_HUB_ORGANIZATION }}/appsmith-server:${{needs.prelude.outputs.tag}} .
# Only build & tag with latest if the tag doesn't contain beta
if [[ ! ${{needs.prelude.outputs.tag}} == *"beta"* ]]; then
docker build --build-arg APPSMITH_SEGMENT_CE_KEY=${{ secrets.APPSMITH_SEGMENT_CE_KEY }} -t ${{ secrets.DOCKER_HUB_ORGANIZATION }}/appsmith-server:latest .
fi
echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
docker push ${{ secrets.DOCKER_HUB_ORGANIZATION }}/appsmith-server