From 96a1d30807f6784a73d4a751c54dffe4a0197d60 Mon Sep 17 00:00:00 2001 From: Toby Drane Date: Wed, 5 Jul 2023 12:00:30 +0100 Subject: [PATCH] release action --- .github/workflows/api-release.yml | 30 --------- .github/workflows/release.yml | 102 ++++++++++++++++++++++++++++++ .github/workflows/sdk-release.yml | 33 ---------- .github/workflows/ui-release.yml | 41 ------------ Makefile | 10 ++- 5 files changed, 110 insertions(+), 106 deletions(-) delete mode 100644 .github/workflows/api-release.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/sdk-release.yml delete mode 100644 .github/workflows/ui-release.yml diff --git a/.github/workflows/api-release.yml b/.github/workflows/api-release.yml deleted file mode 100644 index 771b3bc..0000000 --- a/.github/workflows/api-release.yml +++ /dev/null @@ -1,30 +0,0 @@ -# name: rAPId Release - -# on: -# release: -# types: [released] - -# jobs: -# release: -# runs-on: self-hosted - -# steps: -# - uses: actions/checkout@v2 - -# - name: Export env vars -# run: -# cp ./.github/.github.env .env - -# - name: Export AWS_ACCOUNT -# run: -# echo AWS_ACCOUNT=${{ secrets.AWS_ACCOUNT }} >> .env - -# - name: Export AWS_REGION -# run: -# echo AWS_REGION=${{ secrets.AWS_REGION }} >> .env - -# - name: Build Image -# run: make create-runtime-env - -# - name: Tag and Upload Release Image -# run: make tag-and-upload-release-image diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..1b432be --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,102 @@ +name: rAPId Release + +on: + release: + types: [released] + +jobs: + setup: + runs-on: self-hosted + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Log commit SHA + run: echo $GITHUB_SHA + + api-release: + needs: + - setup + runs-on: self-hosted + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Populate .env with additional vars + run: | + cp ./.github/.github.env .env + echo AWS_ACCOUNT=${{ secrets.AWS_ACCOUNT }} >> .env + echo AWS_REGION=${{ secrets.AWS_REGION }} >> .env + + - name: Build API Image + run: make api-create-image + + - name: API Tag and Upload Release Image + run: make api-tag-and-upload-release-image + + sdk-release: + needs: + - setup + runs-on: self-hosted + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Populate .env with additional vars + run: | + echo "TWINE_USERNAME=${{ secrets.TWINE_USERNAME_TEST }}" >> .env + echo "TWINE_PASSWORD=${{ secrets.TWINE_PASSWORD_TEST }}" >> .env + echo TWINE_NON_INTERACTIVE=${{ secrets.TWINE_NON_INTERACTIVE }} >> .env + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + cache: "pip" + + - name: Setup Python Environment + run: | + make sdk-setup + source sdk/.venv/bin/activate + + - name: SDK Release + run: make sdk-release + + ui-release: + needs: + - setup + runs-on: self-hosted + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 19 + + - name: Install UI Packages + run: make ui-setup + + - name: UI Build Static Files + run: make ui-create-static-out + + - name: UI Zip and Release + env: + TAG: ${{ github.event.release.tag_name }} + run: make ui-zip-and-release tag=$TAG + + cleanup: + needs: + - setup + - api-release + - sdk-release + - ui-release + runs-on: self-hosted + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Clean Docker Context + if: always() + run: make clean-pipeline-docker-context diff --git a/.github/workflows/sdk-release.yml b/.github/workflows/sdk-release.yml deleted file mode 100644 index f2a00b9..0000000 --- a/.github/workflows/sdk-release.yml +++ /dev/null @@ -1,33 +0,0 @@ -# name: Deploy python pacakage to PyPi - -# on: -# release: -# types: [released] - -# jobs: -# release: -# runs-on: self-hosted -# steps: -# - name: Checkout -# uses: actions/checkout@v3 - -# - name: Populate .env with additional vars -# run: | -# echo "AWS_ACCOUNT=${{ secrets.AWS_ACCOUNT }}" >> .env -# echo "AWS_REGION=${{ secrets.AWS_REGION }}" >> .env -# echo "TWINE_USERNAME=${{ secrets.TWINE_USERNAME }}" >> .env -# echo "TWINE_PASSWORD=${{ secrets.TWINE_PASSWORD }}" >> .env -# echo TWINE_NON_INTERACTIVE=${{ secrets.TWINE_NON_INTERACTIVE }} >> .env - -# - name: Install Python -# uses: actions/setup-python@v4 -# with: -# python-version: '3.10' - -# - name: Install python reqs -# run: | -# python3 -m pip install twine - -# - name: Release -# run: | -# make deploy/pypi diff --git a/.github/workflows/ui-release.yml b/.github/workflows/ui-release.yml deleted file mode 100644 index e48b0ec..0000000 --- a/.github/workflows/ui-release.yml +++ /dev/null @@ -1,41 +0,0 @@ -# name: rAPId UI Release - -# on: -# release: -# types: [released] - -# jobs: - -# release: -# runs-on: self-hosted -# env: -# GH_TOKEN: ${{ github.token }} - -# steps: -# - uses: actions/checkout@v3 - -# - uses: actions/setup-node@v3 -# with: -# node-version: 19 - -# - name: Log tag -# env: -# TAG: ${{ github.event.release.tag_name }} -# run: echo $TAG - -# - name: Populate .env with additional vars -# run: | -# cp ./.github/.github.env .env - -# - name: Install packages -# run: make npm-setup - -# - name: Build static files -# run: make create-static-out - -# - name: Zip and release -# env: -# TAG: ${{ github.event.release.tag_name }} -# run: | -# make zip-contents tag=$TAG -# make upload-to-release-prod tag=$TAG diff --git a/Makefile b/Makefile index e10c36e..6ad9778 100644 --- a/Makefile +++ b/Makefile @@ -82,6 +82,9 @@ api-format: ## Run the api code format with black api-tag-and-upload: ## Tag and upload the latest api image @cd api/; $(MAKE) tag-and-upload +api-tag-and-upload-release-image:## Tag and upload the api release image + @cd api/; $(MAKE) tag-and-upload-release-image + api-tag-prod-candidate: ## Tag the uploaded api image as a candidate for PROD deployment @cd api/; $(MAKE) tag-prod-candidate @@ -162,7 +165,10 @@ ui-test: ## Test ui site # UI Release -------------------- ## -ui-zip-and-release: ## Zip and release static ui site - @cd ui/; $(MAKE) zip-contents; $(MAKE) upload-to-release +ui-create-static-out: + @cd ui/; $(MAKE) create-static-out + +ui-zip-and-release: ## Zip and release prod static ui site + @cd ui/; $(MAKE) zip-contents tag=${tag}; $(MAKE) upload-to-release-prod tag=${tag} ##