2021-12-16 23:55:32 +13:00
|
|
|
name: Budibase Release Selfhost
|
2021-10-08 22:37:08 +13:00
|
|
|
|
|
|
|
on:
|
2023-06-07 01:09:35 +12:00
|
|
|
workflow_dispatch:
|
2021-10-08 22:37:08 +13:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
release:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2023-06-06 22:12:29 +12:00
|
|
|
- name: Fail if not a tag
|
2022-08-11 00:57:33 +12:00
|
|
|
run: |
|
2023-06-06 22:12:29 +12:00
|
|
|
if [[ $GITHUB_REF != refs/tags/* ]]; then
|
|
|
|
echo "Workflow Dispatch can only be run on tags"
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-08-11 00:57:33 +12:00
|
|
|
|
2021-10-08 22:37:08 +13:00
|
|
|
- uses: actions/checkout@v2
|
2023-06-07 01:09:35 +12:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2021-12-16 06:43:12 +13:00
|
|
|
|
2023-06-06 22:12:29 +12:00
|
|
|
- name: Fail if tag is not in master
|
|
|
|
run: |
|
|
|
|
if ! git merge-base --is-ancestor ${{ github.sha }} origin/master; then
|
|
|
|
echo "Tag is not in master. This pipeline can only execute tags that are present on the master branch"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-03-02 11:03:34 +13:00
|
|
|
- name: Use Node.js 14.x
|
|
|
|
uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: 14.x
|
|
|
|
|
2022-08-11 00:57:33 +12:00
|
|
|
- name: Get the latest budibase release version
|
|
|
|
id: version
|
|
|
|
run: |
|
2022-08-11 04:07:33 +12:00
|
|
|
release_version=$(cat lerna.json | jq -r '.version')
|
2022-08-11 00:57:33 +12:00
|
|
|
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
|
|
|
|
|
2021-12-16 06:43:12 +13:00
|
|
|
- name: Tag and release Docker images (Self Host)
|
2023-06-07 01:09:35 +12:00
|
|
|
run: |
|
2021-10-08 22:37:08 +13:00
|
|
|
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
|
2021-12-16 06:43:12 +13:00
|
|
|
|
2022-08-11 00:57:33 +12:00
|
|
|
release_tag=v${{ env.RELEASE_VERSION }}
|
2021-12-16 06:43:12 +13:00
|
|
|
|
|
|
|
# Pull apps and worker images
|
2021-12-16 07:40:59 +13:00
|
|
|
docker pull budibase/apps:$release_tag
|
|
|
|
docker pull budibase/worker:$release_tag
|
2022-02-13 00:53:26 +13:00
|
|
|
docker pull budibase/proxy:$release_tag
|
2021-12-16 06:43:12 +13:00
|
|
|
|
|
|
|
# Tag apps and worker images
|
2021-12-17 01:01:43 +13:00
|
|
|
docker tag budibase/apps:$release_tag budibase/apps:$SELFHOST_TAG
|
|
|
|
docker tag budibase/worker:$release_tag budibase/worker:$SELFHOST_TAG
|
2022-02-12 07:40:28 +13:00
|
|
|
docker tag budibase/proxy:$release_tag budibase/proxy:$SELFHOST_TAG
|
2023-06-07 01:09:35 +12:00
|
|
|
|
2021-12-16 06:43:12 +13:00
|
|
|
# Push images
|
2021-12-17 01:01:43 +13:00
|
|
|
docker push budibase/apps:$SELFHOST_TAG
|
|
|
|
docker push budibase/worker:$SELFHOST_TAG
|
2022-02-12 07:40:28 +13:00
|
|
|
docker push budibase/proxy:$SELFHOST_TAG
|
2021-10-08 22:37:08 +13:00
|
|
|
env:
|
|
|
|
DOCKER_USER: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_API_KEY }}
|
2021-12-17 01:01:43 +13:00
|
|
|
SELFHOST_TAG: latest
|
2022-08-09 01:14:35 +12:00
|
|
|
|
|
|
|
- name: Bootstrap and build (CLI)
|
2022-01-14 03:31:17 +13:00
|
|
|
run: |
|
|
|
|
yarn
|
2022-08-09 01:14:35 +12:00
|
|
|
yarn bootstrap
|
2022-01-14 03:31:17 +13:00
|
|
|
yarn build
|
2022-03-01 02:25:09 +13:00
|
|
|
|
2022-03-11 00:08:02 +13:00
|
|
|
- name: Build OpenAPI spec
|
2022-03-01 02:25:09 +13:00
|
|
|
run: |
|
|
|
|
pushd packages/server
|
|
|
|
yarn
|
2022-03-11 00:17:15 +13:00
|
|
|
yarn specs
|
2022-03-01 02:25:09 +13:00
|
|
|
popd
|
2023-06-07 01:09:35 +12:00
|
|
|
|
|
|
|
- name: Setup Helm
|
2021-12-16 07:46:28 +13:00
|
|
|
uses: azure/setup-helm@v1
|
|
|
|
id: helm-install
|
2021-12-17 02:31:40 +13:00
|
|
|
|
2023-01-09 21:21:48 +13:00
|
|
|
# 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
|
2021-12-22 04:05:43 +13:00
|
|
|
- name: Build and release helm chart
|
2023-06-07 01:09:35 +12:00
|
|
|
run: |
|
2021-12-22 04:05:43 +13:00
|
|
|
git config user.name "Budibase Helm Bot"
|
|
|
|
git config user.email "<>"
|
2022-03-15 04:53:24 +13:00
|
|
|
git reset --hard
|
2023-06-06 22:27:08 +12:00
|
|
|
git fetch
|
2023-01-09 21:21:48 +13:00
|
|
|
mkdir sync
|
|
|
|
echo "Packaging chart to sync dir"
|
|
|
|
helm package charts/budibase --version "$RELEASE_VERSION" --app-version "$RELEASE_VERSION" --destination sync
|
|
|
|
echo "Packaging successful"
|
2021-12-22 04:39:40 +13:00
|
|
|
git checkout gh-pages
|
2023-01-09 21:21:48 +13:00
|
|
|
echo "Indexing helm repo"
|
|
|
|
helm repo index --merge docs/index.yaml sync
|
|
|
|
mv -f sync/* docs
|
|
|
|
rm -rf sync
|
|
|
|
echo "Pushing new helm release"
|
2021-12-22 04:05:43 +13:00
|
|
|
git add -A
|
|
|
|
git commit -m "Helm Release: ${{ env.RELEASE_VERSION }}"
|
|
|
|
git push
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2021-12-17 07:24:07 +13:00
|
|
|
|
2021-12-17 01:38:21 +13:00
|
|
|
- name: Perform Github Release
|
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
with:
|
2021-12-17 04:04:08 +13:00
|
|
|
name: v${{ env.RELEASE_VERSION }}
|
2021-12-18 02:58:03 +13:00
|
|
|
tag_name: v${{ env.RELEASE_VERSION }}
|
2022-01-14 03:31:17 +13:00
|
|
|
generate_release_notes: true
|
|
|
|
files: |
|
|
|
|
packages/cli/build/cli-win.exe
|
|
|
|
packages/cli/build/cli-linux
|
2022-02-12 07:40:28 +13:00
|
|
|
packages/cli/build/cli-macos
|
2022-03-01 02:25:09 +13:00
|
|
|
packages/server/specs/openapi.yaml
|
|
|
|
packages/server/specs/openapi.json
|
2022-05-13 20:59:40 +12:00
|
|
|
|
|
|
|
- name: Discord Webhook Action
|
|
|
|
uses: tsickert/discord-webhook@v4.0.0
|
|
|
|
with:
|
|
|
|
webhook-url: ${{ secrets.PROD_DEPLOY_WEBHOOK_URL }}
|
|
|
|
content: "Self Host Deployment Complete: ${{ env.RELEASE_VERSION }} deployed to Self Host."
|
2022-08-09 01:14:35 +12:00
|
|
|
embed-title: ${{ env.RELEASE_VERSION }}
|