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

136 lines
4.2 KiB
YAML
Raw Normal View History

name: Budibase Prerelease
concurrency:
group: release-prerelease
cancel-in-progress: false
2021-07-22 18:21:12 +02:00
on:
push:
2023-04-20 13:50:26 +02:00
tags:
- v*-alpha.*
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-images:
runs-on: ubuntu-latest
2021-07-22 18:21:12 +02:00
steps:
- name: Fail if not a tag
run: |
if [[ $GITHUB_REF != refs/tags/* ]]; then
echo "Workflow Dispatch can only be run on tags"
exit 1
fi
2021-07-22 18:21:12 +02:00
- uses: actions/checkout@v2
with:
submodules: true
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
2023-05-05 15:56:43 +02:00
fetch-depth: 0
2023-04-20 13:50:26 +02:00
2023-04-21 17:49:24 +02:00
- name: Fail if tag is not develop
run: |
if ! git merge-base --is-ancestor ${{ github.sha }} origin/develop; then
echo "Tag is not in develop"
exit 1
fi
2023-04-20 13:50:26 +02:00
2021-07-22 18:21:12 +02:00
- uses: actions/setup-node@v1
with:
node-version: 14.x
2022-04-20 17:11:06 +02:00
2023-05-25 14:27:18 +02:00
- run: yarn install --frozen-lockfile
2023-04-20 13:50:26 +02:00
- name: Update versions
run: |
2023-04-20 17:31:20 +02:00
version=$(cat lerna.json \
2023-04-20 13:50:26 +02:00
| grep version \
| head -1 \
2023-04-20 17:45:14 +02:00
| awk -F: '{gsub(/"/,"",$2);gsub(/[[:space:]]*/,"",$2); print $2}' \
2023-04-20 13:50:26 +02:00
| sed 's/[",]//g')
2023-04-20 17:45:14 +02:00
echo "Setting version $version"
2023-04-20 17:31:20 +02:00
yarn lerna exec "yarn version --no-git-tag-version --new-version=$version"
2023-05-05 16:33:50 +02:00
echo "Updating dependencies"
2023-04-21 18:37:09 +02:00
node scripts/syncLocalDependencies.js $version
2023-05-05 16:33:50 +02:00
echo "Syncing yarn workspace"
2023-04-20 23:57:11 +02:00
yarn
2023-05-22 12:42:14 +02:00
- run: yarn build --configuration=production
- run: yarn build:sdk
2021-07-22 18:21:12 +02:00
2022-04-20 21:32:00 +02:00
- name: Publish budibase packages to NPM
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
2022-04-20 21:32:00 +02:00
# 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 "<>"
2023-04-21 18:29:04 +02:00
git submodule foreach git commit -a -m 'Release process'
git commit -a -m 'Release process'
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:docker:develop
env:
DOCKER_USER: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_API_KEY }}
release-helm-chart:
needs: [release-images]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Helm
uses: azure/setup-helm@v1
id: helm-install
# due to helm repo index issue: https://github.com/helm/helm/issues/7363
# we need to create new package in a different dir, merge the index and move the package back
- name: Build and release helm chart
run: |
git config user.name "Budibase Helm Bot"
git config user.email "<>"
git reset --hard
2023-04-21 13:01:33 +02:00
git fetch
mkdir sync
echo "Packaging chart to sync dir"
helm package charts/budibase --version 0.0.0-develop --app-version develop --destination sync
echo "Packaging successful"
git checkout gh-pages
echo "Indexing helm repo"
helm repo index --merge docs/index.yaml sync
mv -f sync/* docs
rm -rf sync
echo "Pushing new helm release"
git add -A
git commit -m "Helm Release: develop"
git push
2022-12-19 17:04:58 +01:00
trigger-deploy-to-qa-env:
needs: [release-helm-chart]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get the current budibase release version
id: version
run: |
release_version=$(cat lerna.json | jq -r '.version')
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
- uses: passeidireto/trigger-external-workflow-action@main
env:
PAYLOAD_VERSION: ${{ env.RELEASE_VERSION }}
with:
repository: budibase/budibase-deploys
2023-02-17 09:25:10 +01:00
event: budicloud-qa-deploy
github_pat: ${{ secrets.GH_ACCESS_TOKEN }}