Skip to content

Merge pull request #52 from earthrise-media/enable/plausible-analytics #50

Merge pull request #52 from earthrise-media/enable/plausible-analytics

Merge pull request #52 from earthrise-media/enable/plausible-analytics #50

Workflow file for this run

on:
workflow_dispatch:
push:
branches:
- aws-deploy
- main
- develop
jobs:
EveryCommit:
name: Build
runs-on: ubuntu-latest
environment: Production
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get Prod version
if: github.ref == 'refs/heads/main'
run: |
version=$(cat ./version.txt)
echo "version=$version" >> $GITHUB_ENV
- name: Get Dev Version
if: github.ref == 'refs/heads/dev'
run: |
version=$(cat ./version.txt)
timestamp=$(date +%s)
echo "version=$version-dev-$timestamp" >> $GITHUB_ENV
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Build, tag, and push the image
if: github.ref == 'refs/heads/aws-deploy'
id: build-image
run: |
docker build --build-arg PAT=${{ secrets.PAT }} -t ghcr.io/earthrise-media/food-system-digital-twin-website:${{ env.version }} -t 966040274096.dkr.ecr.us-east-2.amazonaws.com/food-twin/site:latest .
docker push ghcr.io/earthrise-media/food-system-digital-twin-website:${{ env.version }}
aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin 966040274096.dkr.ecr.us-east-2.amazonaws.com/food-twin/site
docker push 966040274096.dkr.ecr.us-east-2.amazonaws.com/food-twin/site:latest
- name: Update Deployment
if: github.ref == 'refs/heads/aws-deploy'
run: |
curl -L --output copilot-linux https://github.com/aws/copilot-cli/releases/download/v1.28.0/copilot-linux
chmod +x copilot-linux
./copilot-linux svc deploy --env prod --force