Feature/ascata esdr l2 wind stress v1.1 (#51) #192
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
# 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@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
## 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@v4 | |
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; |