Fix ryhti formatting (#411) #51
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: Deploy | |
on: | |
push: | |
branches: | |
- "main" | |
- "vsl" | |
jobs: | |
check-skip-deploy: | |
runs-on: ubuntu-latest | |
outputs: | |
skip-deploy: ${{ steps.check-skip-label.outputs.skip-deploy }} | |
steps: | |
- name: Check if the commit should be deployed | |
id: check-skip-label | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
SKIP_DEPLOY=false | |
# Get the PR number where the commit was introduced in | |
PR_NUMBER=$(gh pr list --repo ${{ github.repository }} --search ${{ github.sha }} --state merged --json number --jq '.[0].number') | |
echo "The commit was introduced in PR $PR_NUMBER". | |
if [ -n "$PR_NUMBER" ]; then | |
LABELS=$(gh pr view --repo ${{ github.repository }} $PR_NUMBER --json labels --jq '.labels[].name') | |
echo "The PR has the following labels: $(echo "$LABELS" | sed 's/^\|$/"/g' | paste -sd, -)." | |
if echo "$LABELS" | grep -q "skip deploy"; then | |
SKIP_DEPLOY=true | |
fi | |
fi | |
echo "skip-deploy=$SKIP_DEPLOY" >> $GITHUB_OUTPUT | |
echo "skip-deploy: $SKIP_DEPLOY" | |
define-environment: | |
runs-on: ubuntu-latest | |
needs: check-skip-deploy | |
if: ${{ needs.check-skip-deploy.outputs.skip-deploy == 'false' }} | |
outputs: | |
environment: ${{ steps.set-env.outputs.environment }} | |
steps: | |
- name: Set environment | |
id: set-env | |
run: | | |
if [ "${{ github.ref }}" = "refs/heads/vsl" ]; then | |
ENVIRONMENT=vsl-test | |
else | |
ENVIRONMENT=arho-test | |
fi | |
echo "environment=$ENVIRONMENT" >> $GITHUB_OUTPUT | |
build-and-deploy-lambda-functions: | |
runs-on: ubuntu-latest | |
needs: define-environment | |
environment: ${{ needs.define-environment.outputs.environment }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: "3.12" | |
- name: Copy .env file | |
run: cp .env.dev .env | |
- name: Build zip files for lambda | |
run: make build-lambda | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_LAMBDA_UPLOAD_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_LAMBDA_UPLOAD_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Update dev lambda functions | |
run: make prefix=${{ vars.INFRA_PREFIX }} update-lambda -C infra | |
env: | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} | |
- name: Update dev database | |
run: make prefix=${{ vars.INFRA_PREFIX }} migrate-db -C infra |