Create version 4.3.3 #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: develop-images | |
on: | |
push: | |
branches: [ develop ] | |
jobs: | |
buildMacos13FastS3: | |
runs-on: macos-13 | |
environment: Integration | |
steps: | |
- uses: actions/checkout@v3 | |
# this is to fix GIT not liking owner of the checkout dir | |
- name: Set ownership | |
run: | | |
chown -R $(id -u):$(id -g) $PWD | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Deploy to S3 | |
run: | | |
sh ./setup.sh --local | |
sh ./build.sh --system --parallel --upload --release | |
buildMacos12FastS3: | |
runs-on: macos-12 | |
environment: Integration | |
steps: | |
- uses: actions/checkout@v3 | |
# this is to fix GIT not liking owner of the checkout dir | |
- name: Set ownership | |
run: | | |
chown -R $(id -u):$(id -g) $PWD | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Deploy to S3 | |
run: | | |
sh ./setup.sh --local | |
sh ./build.sh --system --parallel --upload --release | |
buildMacos11FastS3: | |
runs-on: macos-11 | |
environment: Integration | |
steps: | |
- uses: actions/checkout@v3 | |
# this is to fix GIT not liking owner of the checkout dir | |
- name: Set ownership | |
run: | | |
chown -R $(id -u):$(id -g) $PWD | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Deploy to S3 | |
run: | | |
sh ./setup.sh --local | |
sh ./build.sh --system --parallel --upload --release | |
buildUbuntu22FastS3: | |
runs-on: ubuntu-22.04 | |
environment: Integration | |
container: | |
image: ubuntu:jammy | |
steps: | |
# this is to fix GIT not liking owner of the checkout dir | |
- name: Set ownership and prep container | |
run: | | |
mkdir -p /usr/local/var | |
apt-get update && apt-get install -y apt-transport-https | |
apt-get install -y git curl nano sudo zip | |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | |
unzip awscliv2.zip | |
sudo ./aws/install | |
- uses: actions/checkout@v3 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Deploy to S3 | |
run: | | |
sudo aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY }} && sudo aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }} && sudo aws configure set default.region ${{ secrets.AWS_REGION }} | |
export GIT_DISCOVERY_ACROSS_FILESYSTEM=1 | |
chown -R root $PWD | |
sudo sh ./setup.sh --local | |
sudo sh ./build.sh --system --parallel | |
gridlabd python -m pip install awscli | |
sudo sh ./build.sh --upload --release | |
buildUbuntu20FastS3: | |
runs-on: ubuntu-20.04 | |
environment: Integration | |
container: | |
image: ubuntu:focal | |
steps: | |
# this is to fix GIT not liking owner of the checkout dir | |
- name: Set ownership and prep container | |
run: | | |
mkdir -p /usr/local/var | |
apt-get update && apt-get install -y apt-transport-https | |
apt-get install -y git curl nano sudo zip | |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | |
unzip awscliv2.zip | |
sudo ./aws/install | |
- uses: actions/checkout@v3 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Deploy to S3 | |
run: | | |
sudo aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY }} && sudo aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }} && sudo aws configure set default.region ${{ secrets.AWS_REGION }} | |
export GIT_DISCOVERY_ACROSS_FILESYSTEM=1 | |
chown -R root $PWD | |
sudo sh ./setup.sh --local | |
sudo sh ./build.sh --system --parallel | |
gridlabd python -m pip install awscli | |
sudo sh ./build.sh --upload --release | |
buildAWSUbuntuAMI: | |
runs-on: ubuntu-latest | |
environment: Integration | |
needs: [buildUbuntu22FastS3,buildUbuntu20FastS3,buildMacos11FastS3,buildMacos12FastS3,buildMacos13FastS3] | |
steps: | |
- uses: actions/checkout@v3 | |
# this is to fix GIT not liking owner of the checkout dir | |
- name: Set ownership | |
run: | | |
chown -R $(id -u):$(id -g) $PWD | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Run CF invalidation | |
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.DEV_CF_ID }} --paths '/*' | |
- name: Set output | |
run: | | |
echo "VERSION=Arras Energy HiPAS GridLAB-D $(./build-aux/version.sh --version) (Developer)" >> $GITHUB_ENV | |
echo "TAGNAME=gridlabd/$(./build-aux/version.sh --version)-$(./build-aux/version.sh --number)-$(./build-aux/version.sh --branch)" >> $GITHUB_ENV | |
- name: Install Packer | |
run: | | |
wget https://releases.hashicorp.com/packer/1.7.6/packer_1.7.6_linux_amd64.zip | |
unzip packer_1.7.6_linux_amd64.zip | |
sudo mv packer /usr/local/bin | |
- name: Initialize Packer | |
run: | | |
packer init ./docker/packer/templateDevelop.pkr.hcl | |
- name: Build AMI Image | |
run: | | |
packer build \ | |
-var "aws_access_key=${{ secrets.AWS_ACCESS_KEY }}" \ | |
-var "aws_secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY }}" \ | |
-var "aws_region=${{ secrets.AWS_REGION }}" \ | |
-var "dev_s3_url=${{ secrets.DEV_S3_URL }}" \ | |
-var "version=${{ env.VERSION }}" \ | |
-var "tagname=${{ env.TAGNAME }}" \ | |
./docker/packer/templateDevelop.pkr.hcl | |
buildUbuntuDockerhub: | |
runs-on: ubuntu-latest | |
environment: Integration | |
needs: buildUbuntu22FastS3 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Run CF invalidation | |
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.DEV_CF_ID }} --paths '/*' | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./docker/packer/Dockerfile.dev.ul | |
push: true | |
tags: lfenergy/arras:develop | |
updateS3websites: | |
runs-on: ubuntu-latest | |
environment: Integration | |
steps: | |
- uses: actions/checkout@v3 | |
# this is to fix GIT not liking owner of the checkout dir | |
- name: Set ownership | |
run: | | |
chown -R $(id -u):$(id -g) $PWD | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Website s3 sync | |
run: | | |
aws s3 sync ./cloud/websites/code.gridlabd.us/ s3://code-dev.gridlabd.us --acl public-read | |
aws s3 sync ./cloud/websites/docs.gridlabd.us/ s3://docs-dev.gridlabd.us --acl public-read | |
aws s3 sync ./cloud/websites/geodata.gridlabd.us/ s3://geodata-dev.gridlabd.us --acl public-read | |
aws s3 sync ./cloud/websites/install.gridlabd.us/ s3://install-dev.gridlabd.us --acl public-read | |
aws s3 sync ./cloud/websites/status.gridlabd.us/ s3://status-dev.gridlabd.us --acl public-read | |
aws s3 sync ./cloud/websites/tutorials.gridlabd.us/ s3://tutorials-dev.gridlabd.us --acl public-read | |
aws s3 sync ./cloud/websites/www.gridlabd.us/ s3://www-dev.gridlabd.us --acl public-read | |
- name: Run CF invalidation | |
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.DEV_CF_ID }} --paths '/*' | |
versionUpdate: | |
runs-on: ubuntu-latest | |
environment: Integration | |
needs: buildAWSUbuntuAMI | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Install dependencies and package Lambda function | |
run: | | |
pip install -r ./cloud/websites/version.gridlabd.us/lambda/requirements.txt -t ./cloud/websites/version.gridlabd.us/lambda/package | |
cd ./cloud/websites/version.gridlabd.us/lambda/package | |
zip -r ../lambda.zip . | |
cd .. | |
zip -r lambda.zip app.py | |
- name: Update Lambda image version_handler | |
run: | | |
aws lambda update-function-code --function-name version_handler --zip-file fileb://$(pwd)/cloud/websites/version.gridlabd.us/lambda/lambda.zip | |
- name: Update Lambda image update_latest | |
run: | | |
aws lambda update-function-code --function-name update_latest --zip-file fileb://$(pwd)/cloud/websites/version.gridlabd.us/lambda/lambda.zip | |
- name: Make POST request to version.gridlabd.us/update | |
run: | | |
version=$(./build-aux/version.sh --version) | |
build=$(./build-aux/version.sh --number) | |
branch=$(./build-aux/version.sh --branch) | |
curl -f -X POST "https://version.gridlabd.us/update_latest" \ | |
-H "Content-Type: application/json" \ | |
-d "{\"version\": \"$version\", \"build\": \"$build\", \"branch\": \"$branch\", \"sk\": \"${{ secrets.DEVELOPSK }}\"}" |