From bced175148538bb8795e854dbf32fdf905fa8382 Mon Sep 17 00:00:00 2001 From: J Date: Thu, 28 Jul 2022 12:35:11 +0100 Subject: [PATCH 1/7] Create s3-zip.yaml --- .github/workflows/s3-zip.yaml | 49 +++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/s3-zip.yaml diff --git a/.github/workflows/s3-zip.yaml b/.github/workflows/s3-zip.yaml new file mode 100644 index 00000000..9317d6a5 --- /dev/null +++ b/.github/workflows/s3-zip.yaml @@ -0,0 +1,49 @@ +name: Upload to S3 +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + + paths-ignore: + - '**/README.md' + +jobs: + deploy_dev: + runs-on: ubuntu-latest + steps: + + - name: Set env + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: checkout code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.10.x + + - name: create python env + run: python -m venv .venv + + - name: install dependencies + run: source .venv/bin/activate && python -m pip install --upgrade pip && pip install -r requirements.txt + + - name: build static assets + run: python build.py + + - uses: vimtor/action-zip@v1 + with: + files: './' + dest: ./zip/${{ github.event.repository.name }}-${{github.ref_name}}.zip + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-secret-access-key: ${{ secrets.PAAS_AWS_SECRET_ACCESS_KEY}} + aws-access-key-id: ${{ secrets.PAAS_AWS_KEY_ID }} + aws-region: eu-west-2 + + - name: Copy files to the test website with the AWS CLI + run: | + aws s3 sync ./zip s3://${{ secrets.PAAS_AWS_BUCKET }} From 8fae5666187d0adec78a6313e71f382a26d14be4 Mon Sep 17 00:00:00 2001 From: Harrington Date: Tue, 2 Aug 2022 09:07:57 +0100 Subject: [PATCH 2/7] Update s3-zip.yaml --- .github/workflows/s3-zip.yaml | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/.github/workflows/s3-zip.yaml b/.github/workflows/s3-zip.yaml index 9317d6a5..398d6e33 100644 --- a/.github/workflows/s3-zip.yaml +++ b/.github/workflows/s3-zip.yaml @@ -7,6 +7,12 @@ on: paths-ignore: - '**/README.md' +env: + # This uses the default config, since + # build is not a actual config file in envs. + FLASK_ENV : build + + jobs: deploy_dev: runs-on: ubuntu-latest @@ -30,20 +36,17 @@ jobs: run: source .venv/bin/activate && python -m pip install --upgrade pip && pip install -r requirements.txt - name: build static assets - run: python build.py + run: source .venv/bin/activate && python build.py - - uses: vimtor/action-zip@v1 + - name: Archive Release + uses: thedoctor0/zip-release@main with: - files: './' - dest: ./zip/${{ github.event.repository.name }}-${{github.ref_name}}.zip + type: 'zip' + filename: '${{ github.event.repository.name }}-${{github.ref_name}}.zip' + exclusions: '*.git* *.venv/* *tests/*' - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 + - name: Upload Release + uses: ncipollo/release-action@v1 with: - aws-secret-access-key: ${{ secrets.PAAS_AWS_SECRET_ACCESS_KEY}} - aws-access-key-id: ${{ secrets.PAAS_AWS_KEY_ID }} - aws-region: eu-west-2 - - - name: Copy files to the test website with the AWS CLI - run: | - aws s3 sync ./zip s3://${{ secrets.PAAS_AWS_BUCKET }} + artifacts: '${{ github.event.repository.name }}-${{github.ref_name}}.zip' + token: ${{ secrets.GITHUB_TOKEN }} From eb0cbe12606ccba75d5db9c2ab05fd1fa408bc7e Mon Sep 17 00:00:00 2001 From: Harrington Date: Mon, 8 Aug 2022 22:00:02 +0100 Subject: [PATCH 3/7] Update and rename s3-zip.yaml to tag-to-release.yaml --- .github/workflows/{s3-zip.yaml => tag-to-release.yaml} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{s3-zip.yaml => tag-to-release.yaml} (97%) diff --git a/.github/workflows/s3-zip.yaml b/.github/workflows/tag-to-release.yaml similarity index 97% rename from .github/workflows/s3-zip.yaml rename to .github/workflows/tag-to-release.yaml index 398d6e33..f70a7416 100644 --- a/.github/workflows/s3-zip.yaml +++ b/.github/workflows/tag-to-release.yaml @@ -1,4 +1,4 @@ -name: Upload to S3 +name: Tag-zip release on: push: tags: @@ -14,7 +14,7 @@ env: jobs: - deploy_dev: + release_tag: runs-on: ubuntu-latest steps: From 37305d721f897e8b8de03ac79ce249d71c704d33 Mon Sep 17 00:00:00 2001 From: Harrington Date: Thu, 18 Aug 2022 10:36:32 +0100 Subject: [PATCH 4/7] Update tag-to-release.yaml --- .github/workflows/tag-to-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tag-to-release.yaml b/.github/workflows/tag-to-release.yaml index f70a7416..0ecd6b03 100644 --- a/.github/workflows/tag-to-release.yaml +++ b/.github/workflows/tag-to-release.yaml @@ -36,7 +36,7 @@ jobs: run: source .venv/bin/activate && python -m pip install --upgrade pip && pip install -r requirements.txt - name: build static assets - run: source .venv/bin/activate && python build.py + run: source .venv/bin/activate && export FLASK_ENV=build && python build.py - name: Archive Release uses: thedoctor0/zip-release@main From 7de4c29670d8d950bcd8215ed5f90661aad7d6af Mon Sep 17 00:00:00 2001 From: Harrington Date: Thu, 18 Aug 2022 10:37:27 +0100 Subject: [PATCH 5/7] Update tag-to-release.yaml --- .github/workflows/tag-to-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tag-to-release.yaml b/.github/workflows/tag-to-release.yaml index 0ecd6b03..f70a7416 100644 --- a/.github/workflows/tag-to-release.yaml +++ b/.github/workflows/tag-to-release.yaml @@ -36,7 +36,7 @@ jobs: run: source .venv/bin/activate && python -m pip install --upgrade pip && pip install -r requirements.txt - name: build static assets - run: source .venv/bin/activate && export FLASK_ENV=build && python build.py + run: source .venv/bin/activate && python build.py - name: Archive Release uses: thedoctor0/zip-release@main From 5f22d897cc22c821abf5b0b2ed00754e68fdc813 Mon Sep 17 00:00:00 2001 From: Harrington Date: Thu, 18 Aug 2022 10:39:24 +0100 Subject: [PATCH 6/7] Create .FLASKENV --- .FLASKENV | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .FLASKENV diff --git a/.FLASKENV b/.FLASKENV new file mode 100644 index 00000000..5cd4b3a5 --- /dev/null +++ b/.FLASKENV @@ -0,0 +1,3 @@ +FLASK_APP=app.py +FLASK_ENV=development +FLASK_RUN_PORT=5000 From d7646bc42802ea69349b1a5ef8dc1eaee1c65a61 Mon Sep 17 00:00:00 2001 From: Harrington Date: Thu, 18 Aug 2022 10:41:30 +0100 Subject: [PATCH 7/7] Delete .FLASKENV --- .FLASKENV | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .FLASKENV diff --git a/.FLASKENV b/.FLASKENV deleted file mode 100644 index 5cd4b3a5..00000000 --- a/.FLASKENV +++ /dev/null @@ -1,3 +0,0 @@ -FLASK_APP=app.py -FLASK_ENV=development -FLASK_RUN_PORT=5000