budibase/.github/workflows/release-develop.yml

137 lines
4.3 KiB
YAML
Raw Normal View History

name: Budibase Prerelease
concurrency: release-prerelease
2021-07-22 18:21:12 +02:00
on:
push:
2021-07-22 18:21:12 +02:00
branches:
- develop
2021-12-31 14:59:48 +01:00
paths:
- '.aws/**'
- '.github/**'
- 'charts/**'
- 'packages/**'
- 'scripts/**'
- 'package.json'
- 'yarn.lock'
- 'package.json'
- 'yarn.lock'
workflow_dispatch:
2021-07-22 18:21:12 +02:00
env:
2022-08-08 12:51:38 +02:00
# Posthog token used by ui at build time
# disable unless needed for testing
# POSTHOG_TOKEN: phc_uDYOfnFt6wAbBAXkC6STjcrTpAFiWIhqgFcsC1UVO5F
2021-09-21 12:47:14 +02:00
INTERCOM_TOKEN: ${{ secrets.INTERCOM_TOKEN }}
2022-06-28 23:45:05 +02:00
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
2022-06-28 19:07:43 +02:00
FEATURE_PREVIEW_URL: https://budirelease.live
2021-07-22 18:21:12 +02:00
jobs:
release:
runs-on: ubuntu-latest
2021-07-22 18:21:12 +02:00
steps:
- name: Fail if branch is not develop
if: github.ref != 'refs/heads/develop'
run: |
echo "Ref is not develop, you must run this job from develop."
exit 1
2021-07-22 18:21:12 +02:00
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
2022-04-20 17:11:06 +02:00
2022-04-21 22:55:16 +02:00
- name: Install Pro
run: yarn install:pro develop
2022-04-20 17:11:06 +02:00
- run: yarn
- run: yarn bootstrap
- run: yarn lint
- run: yarn build
2021-07-22 18:21:12 +02:00
- run: yarn test
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
2022-04-20 21:32:00 +02:00
- name: Publish budibase packages to NPM
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
# setup the username and email.
2022-04-20 21:59:37 +02:00
git config --global user.name "Budibase Staging Release Bot"
git config --global user.email "<>"
2022-04-20 21:32:00 +02:00
echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} >> .npmrc
yarn release:develop
2022-04-20 17:11:06 +02:00
- name: Build/release Docker images
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
yarn build
yarn build:docker:develop
env:
DOCKER_USER: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_API_KEY }}
2022-05-26 14:58:17 +02:00
2022-05-26 15:39:37 +02:00
- name: Get the latest budibase release version
2022-05-26 14:58:17 +02:00
id: version
run: |
release_version=$(cat lerna.json | jq -r '.version')
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
- name: Tag and release Proxy service docker image
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
2022-05-27 01:10:43 +02:00
yarn build:docker:proxy:release
2022-05-26 15:39:37 +02:00
docker tag proxy-service budibase/proxy:$RELEASE_TAG
docker push budibase/proxy:$RELEASE_TAG
2022-05-26 14:58:17 +02:00
env:
DOCKER_USER: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_API_KEY }}
2022-05-26 15:39:37 +02:00
RELEASE_TAG: k8s-release
2022-05-26 14:58:17 +02:00
- name: Pull values.yaml from budibase-infra
run: |
curl -H "Authorization: token ${{ secrets.GH_PERSONAL_TOKEN }}" \
-H 'Accept: application/vnd.github.v3.raw' \
2022-05-26 15:39:37 +02:00
-o values.release.yaml \
-L https://api.github.com/repos/budibase/budibase-infra/contents/kubernetes/budibase-release/values.yaml
wc -l values.release.yaml
2022-05-26 14:58:17 +02:00
2022-05-26 15:39:37 +02:00
- name: Deploy to Release Environment
2022-05-26 14:58:17 +02:00
uses: glopezep/helm@v1.7.1
with:
2022-05-26 15:39:37 +02:00
release: budibase-release
2022-05-26 14:58:17 +02:00
namespace: budibase
chart: charts/budibase
token: ${{ github.token }}
helm: helm3
values: |
globals:
2022-05-27 01:34:32 +02:00
appVersion: develop
2022-05-26 14:58:17 +02:00
ingress:
enabled: true
nginx: true
value-files: >-
[
2022-05-26 15:39:37 +02:00
"values.release.yaml"
2022-05-26 14:58:17 +02:00
]
env:
2022-05-26 15:39:37 +02:00
KUBECONFIG_FILE: '${{ secrets.RELEASE_KUBECONFIG }}'
2022-05-26 14:58:17 +02:00
- name: Re roll the services
uses: actions-hub/kubectl@master
env:
KUBE_CONFIG: ${{ secrets.RELEASE_KUBECONFIG }}
with:
args: rollout restart deployment proxy-service -n budibase && kubectl rollout restart deployment app-service -n budibase && kubectl rollout restart deployment worker-service -n budibase
2022-05-26 14:58:17 +02:00
- name: Discord Webhook Action
uses: tsickert/discord-webhook@v4.0.0
with:
webhook-url: ${{ secrets.PROD_DEPLOY_WEBHOOK_URL }}
2022-05-26 15:39:37 +02:00
content: "Release Env Deployment Complete: ${{ env.RELEASE_VERSION }} deployed to Budibase Release Env."
2022-06-28 19:07:43 +02:00
embed-title: ${{ env.RELEASE_VERSION }}