Skip to content

Commit

Permalink
added release assets
Browse files Browse the repository at this point in the history
  • Loading branch information
mguptahub committed Aug 29, 2024
1 parent 83a6ba8 commit 1968242
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 4 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/build-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -339,3 +339,52 @@ jobs:
DOCKER_BUILDKIT: 1
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}

publish_assets:
if : ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
needs: [branch_build_push_web, branch_build_push_admin, branch_build_push_space, branch_build_push_apiserver, branch_build_push_proxy]
steps:
- id: checkout_files
name: Checkout Files
uses: actions/checkout@v4

- name: Update shell script branch
run: |
sed -i "s/^RELEASE_TAG=.*/RELEASE_TAG=${{ github.event.release.tag_name }}/" ./deploy/selfhost/install.sh
sed -i "s/^export APP_RELEASE=.*/export APP_RELEASE=${{ github.event.release.tag_name }}/g" ./deploy/selfhost/install.sh
sed -i "s/APP_RELEASE=stable/APP_RELEASE=${{ github.event.release.tag_name }}/g" ./deploy/selfhost/install.sh
sed -i "s/^APP_RELEASE=.*/APP_RELEASE=${{ github.event.release.tag_name }}/" ./deploy/selfhost/variables.env
echo "Release Upload URL :::: ${{ github.event.release.upload_url }}"
- name: Upload docker-compose.yaml
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./deploy/selfhost/docker-compose.yml
asset_name: docker-compose.yaml
asset_content_type: application/octet-stream

- name: Upload variables.env
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./deploy/selfhost/variables.env
asset_name: variables.env
asset_content_type: application/octet-stream

- name: Upload setup.sh
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./deploy/selfhost/install.sh
asset_name: setup.sh
asset_content_type: application/octet-stream
28 changes: 24 additions & 4 deletions deploy/selfhost/install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

BRANCH=${BRANCH:-master}
RELEASE_TAG="v0.22-dev"
SCRIPT_DIR=$PWD
SERVICE_FOLDER=plane-app
PLANE_INSTALL_DIR=$PWD/$SERVICE_FOLDER
Expand Down Expand Up @@ -166,11 +167,13 @@ function syncEnvFile(){
updateEnvFile "$key" "$value" "$DOCKER_ENV_PATH"
fi
done < "$DOCKER_ENV_PATH"
# Replace APP_RELEASE with the latest value
updateEnvFile "APP_RELEASE" "$APP_RELEASE" "$DOCKER_ENV_PATH"
fi
echo "Environment variables synced successfully" >&2
}

function buildYourOwnImage(){
function buildYourOwnImage() {
echo "Building images locally..."

export DOCKERHUB_USER="myplane"
Expand Down Expand Up @@ -232,8 +235,25 @@ function download() {
mv $PLANE_INSTALL_DIR/docker-compose.yaml $PLANE_INSTALL_DIR/archive/$TS.docker-compose.yaml
fi

curl -H 'Cache-Control: no-cache, no-store' -s -o $PLANE_INSTALL_DIR/docker-compose.yaml https://raw.githubusercontent.com/makeplane/plane/$BRANCH/deploy/selfhost/docker-compose.yml?$(date +%s)
curl -H 'Cache-Control: no-cache, no-store' -s -o $PLANE_INSTALL_DIR/variables-upgrade.env https://raw.githubusercontent.com/makeplane/plane/$BRANCH/deploy/selfhost/variables.env?$(date +%s)
curl -H 'Cache-Control: no-cache, no-store' -s -o $PLANE_INSTALL_DIR/docker-compose.yaml https://github.com/makeplane/plane/releases/download/$RELEASE_TAG/docker-compose.yaml?$(date +%s)

Check warning on line 238 in deploy/selfhost/install.sh

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

deploy/selfhost/install.sh#L238

Double quote to prevent globbing and word splitting.
if [ $? -ne 0 ]; then
# 2nd attempt to download the file for backward compatibility
curl -H 'Cache-Control: no-cache, no-store' -s -o $PLANE_INSTALL_DIR/docker-compose.yaml https://raw.githubusercontent.com/makeplane/plane/$BRANCH/deploy/selfhost/docker-compose.yml?$(date +%s)
if [ $? -ne 0 ]; then
echo "Failed to download the docker-compose.yaml file. Exiting..."
exit 1
fi
fi

curl -H 'Cache-Control: no-cache, no-store' -s -o $PLANE_INSTALL_DIR/variables-upgrade.env https://github.com/makeplane/plane/releases/download/$RELEASE_TAG/variables.env?$(date +%s)

Check warning on line 248 in deploy/selfhost/install.sh

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

deploy/selfhost/install.sh#L248

Double quote to prevent globbing and word splitting.
if [ $? -ne 0 ]; then
# 2nd attempt to download the file for backward compatibility
curl -H 'Cache-Control: no-cache, no-store' -s -o $PLANE_INSTALL_DIR/variables-upgrade.env https://raw.githubusercontent.com/makeplane/plane/$BRANCH/deploy/selfhost/variables.env?$(date +%s)
if [ $? -ne 0 ]; then
echo "Failed to download the variables.env file. Exiting..."
exit 1
fi
fi

if [ -f "$DOCKER_ENV_PATH" ];
then
Expand Down Expand Up @@ -339,7 +359,7 @@ function upgrade() {
stopServices

echo
echo "***** DOWNLOADING STABLE VERSION ****"
echo "***** DOWNLOADING $APP_RELEASE VERSION ****"
install

echo "***** PLEASE VALIDATE AND START SERVICES ****"
Expand Down

0 comments on commit 1968242

Please sign in to comment.