Skip to content

Merge branch 'main' into develop #130

Merge branch 'main' into develop

Merge branch 'main' into develop #130

Workflow file for this run

# This is the main build pipeline that verifies and publishes the software
name: Build
# Controls when the workflow will run
on:
# Triggers the workflow on push events
push:
branches: [ develop, main, feature/**, issue/**, issues/**]
pull_request:
types:
- opened
branches:
- 'main'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
# First job in the workflow installs and verifies the software
build:
name: Build, Test, Deploy
# The type of runner that the job will run on
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
## Update env for alpha
- name: Alpha
if: ${{ startsWith(github.ref, 'refs/heads/feature/') }} ||
${{ startsWith(github.ref, 'refs/heads/develop/') }} ||
${{ startsWith(github.ref, 'refs/heads/issue/') }} ||
${{ startsWith(github.ref, 'refs/heads/issues/') }}
run: echo "TARGET_ENV=sit" >> $GITHUB_ENV|
echo "TARGET_ENV_UPPERCASE=SIT" >> $GITHUB_ENV
## Update env for release candidates
- name: Release Candidate
if: ${{ contains(github.base_ref, 'main') }}
run: echo "TARGET_ENV=uat" >> $GITHUB_ENV|
echo "TARGET_ENV_UPPERCASE=UAT" >> $GITHUB_ENV
## Update env for release
- name: Release
if: ${{ startsWith(github.ref, 'refs/heads/main') }}
run: echo "TARGET_ENV=ops" >> $GITHUB_ENV |
echo "TARGET_ENV_UPPERCASE=OPS" >> $GITHUB_ENV
## Deployment
- name: Set AWS Env Variables
run: echo "AWS_ACCESS_KEY_ID=${{ secrets[format('AWS_ACCESS_KEY_ID_SERVICES_{0}', env.TARGET_ENV_UPPERCASE)] }}" >> $GITHUB_ENV |
echo "AWS_SECRET_ACCESS_KEY=${{ secrets[format('AWS_SECRET_ACCESS_KEY_SERVICES_{0}', env.TARGET_ENV_UPPERCASE)] }}" >> $GITHUB_ENV
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
env:
AWS_ACCESS_KEY_ID: ${{ secrets[format('AWS_ACCESS_KEY_ID_SERVICES_{0}', env.TARGET_ENV_UPPERCASE)] }}
AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_SERVICES_{0}', env.TARGET_ENV_UPPERCASE)] }}
with:
aws-region: us-west-2
role-session-name: GitHubActions
- run: aws sts get-caller-identity
- name: Sync S3
if: |
github.ref == 'refs/heads/develop' ||
github.ref == 'refs/heads/main' ||
contains(github.base_ref, 'main') ||
${{ github.event.head_commit.message }} == "/github_actions deploy"
run:
aws s3 sync ./config-files s3://podaac-services-${{ env.TARGET_ENV}}-hitide/dataset-configs --delete --metadata githash=${GITHUB_SHA} --size-only;
aws s3 sync ./palettes s3://podaac-services-${{ env.TARGET_ENV}}-hitide/palettes --delete --metadata githash=${GITHUB_SHA} --size-only;