Small typo in the profile index page (italian language) (#3755) #2392
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 | |
concurrency: deploy-${{ fromJSON('["pastaporto", "production"]')[github.ref == 'refs/heads/main'] }} | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
comment-id: | |
description: 'The comment-id of the slash command' | |
required: false | |
event-number: | |
description: 'The event-id of the slash command' | |
required: false | |
env: | |
TF_WORKSPACE: ${{ fromJSON('["pastaporto", "production"]')[github.ref == 'refs/heads/main'] }} | |
jobs: | |
create-db: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./infrastructure/applications | |
steps: | |
- uses: actions/checkout@v2 | |
if: github.ref != 'refs/heads/main' | |
with: | |
ref: ${{ github.ref }} | |
fetch-depth: 0 | |
- name: Configure AWS credentials | |
if: github.ref != 'refs/heads/main' | |
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: eu-central-1 | |
- uses: hashicorp/setup-terraform@v1 | |
if: github.ref != 'refs/heads/main' | |
with: | |
terraform_version: 1.2.4 | |
- name: Terraform Init | |
if: github.ref != 'refs/heads/main' | |
run: terraform init | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Terraform apply | |
if: github.ref != 'refs/heads/main' | |
run: terraform apply -target module.database -no-color -auto-approve &> /dev/null | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: eu-central-1 | |
build-and-push-service: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
strategy: | |
fail-fast: false | |
matrix: | |
service: | |
- name: pycon-backend | |
dir: backend | |
- name: pretix | |
dir: pretix | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.ref }} | |
fetch-depth: 0 | |
- 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: eu-central-1 | |
- name: Get service githash | |
id: git | |
run: | | |
hash=$(git rev-list -1 HEAD -- ${{ matrix.service.dir }}) | |
echo "::set-output name=githash::$hash" | |
- name: Check if commit is already on ECR | |
id: image | |
run: | | |
set +e | |
aws ecr describe-images --repository-name=pythonit/${{ matrix.service.name }} --image-ids=imageTag=${{ steps.git.outputs.githash }} | |
if [[ $? == 0 ]]; then | |
echo '::set-output name=image_exists::1' | |
else | |
echo '::set-output name=image_exists::0' | |
fi | |
- name: Set up QEMU dependency | |
if: ${{ steps.image.outputs.image_exists == 0 }} | |
uses: docker/setup-qemu-action@v2 | |
- name: Login to GitHub Packages | |
if: ${{ steps.image.outputs.image_exists == 0 }} | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to Amazon ECR | |
if: ${{ steps.image.outputs.image_exists == 0 }} | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Set up Docker Buildx | |
id: buildx | |
if: ${{ steps.image.outputs.image_exists == 0 }} | |
uses: docker/setup-buildx-action@v2 | |
- name: Cache Docker layers | |
if: ${{ steps.image.outputs.image_exists == 0 }} | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ matrix.service.name }} | |
- name: Build and push | |
if: ${{ steps.image.outputs.image_exists == 0 }} | |
uses: docker/[email protected] | |
with: | |
context: ./${{ matrix.service.dir }} | |
file: ./${{ matrix.service.dir }}/Dockerfile | |
builder: ${{ steps.buildx.outputs.name }} | |
provenance: false | |
push: true | |
tags: | | |
${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.eu-central-1.amazonaws.com/pythonit/${{ matrix.service.name }}:${{ steps.git.outputs.githash }} | |
ghcr.io/pythonitalia/pycon/${{ matrix.service.name }}:${{ steps.git.outputs.githash }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
platforms: linux/amd64 | |
build-emails: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./email-templates/ | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.ref }} | |
- uses: pnpm/[email protected] | |
with: | |
version: 7.3.0 | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build templates | |
run: pnpm run build | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: built-email-templates | |
path: email-templates/build_production | |
# Apply infrastructure changes | |
# azure-terraform: | |
# runs-on: ubuntu-latest | |
# needs: [build-emails, build-and-push-service, create-db] | |
# environment: | |
# name: ${{ fromJSON('["pastaporto", "production"]')[github.ref == 'refs/heads/main'] }} | |
# defaults: | |
# run: | |
# working-directory: ./infrastructure/azure-applications | |
# steps: | |
# - uses: actions/checkout@v2 | |
# with: | |
# ref: ${{ github.ref }} | |
# fetch-depth: 0 | |
# - name: Setup Terraform | |
# uses: hashicorp/setup-terraform@v2 | |
# with: | |
# cli_config_credentials_token: ${{ secrets.TF_CLOUD_TOKEN }} | |
# - name: Terraform Init | |
# run: terraform init | |
# env: | |
# TF_WORKSPACE: applications-${{ fromJSON('["staging", "production"]')[github.ref == 'refs/heads/main'] }} | |
# - name: Terraform Validate | |
# run: terraform validate -no-color | |
# env: | |
# TF_WORKSPACE: applications-${{ fromJSON('["staging", "production"]')[github.ref == 'refs/heads/main'] }} | |
# - name: Githash | |
# id: githash | |
# run: | | |
# echo "TF_VAR_githash_users_backend=$(git rev-list -1 HEAD -- $GITHUB_WORKSPACE/users-backend/)" >> "$GITHUB_OUTPUT" | |
# echo "TF_VAR_githash_association_backend=$(git rev-list -1 HEAD -- $GITHUB_WORKSPACE/association-backend/)" >> "$GITHUB_OUTPUT" | |
# echo "TF_VAR_githash_pycon_backend=$(git rev-list -1 HEAD -- $GITHUB_WORKSPACE/backend/)" >> "$GITHUB_OUTPUT" | |
# echo "TF_VAR_githash_cms=$(git rev-list -1 HEAD -- $GITHUB_WORKSPACE/cms/)" >> "$GITHUB_OUTPUT" | |
# env: | |
# TF_WORKSPACE: applications-${{ fromJSON('["staging", "production"]')[github.ref == 'refs/heads/main'] }} | |
# - name: Terraform apply | |
# run: terraform apply -no-color -auto-approve &> /dev/null | |
# env: | |
# TF_VAR_githash_users_backend: ${{ steps.githash.outputs.TF_VAR_githash_users_backend }} | |
# TF_VAR_githash_association_backend: ${{ steps.githash.outputs.TF_VAR_githash_association_backend }} | |
# TF_VAR_githash_pycon_backend: ${{ steps.githash.outputs.TF_VAR_githash_pycon_backend }} | |
# TF_VAR_githash_cms: ${{ steps.githash.outputs.TF_VAR_githash_cms }} | |
# TF_WORKSPACE: applications-${{ fromJSON('["staging", "production"]')[github.ref == 'refs/heads/main'] }} | |
terraform: | |
runs-on: ubuntu-latest | |
needs: [build-emails, build-and-push-service, create-db] | |
environment: | |
name: ${{ fromJSON('["pastaporto", "production"]')[github.ref == 'refs/heads/main'] }} | |
defaults: | |
run: | |
working-directory: ./infrastructure/applications | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.ref }} | |
fetch-depth: 0 | |
- uses: actions/download-artifact@v2 | |
with: | |
name: built-email-templates | |
path: email-templates/build_production | |
- uses: hashicorp/setup-terraform@v1 | |
with: | |
terraform_version: 1.2.4 | |
- name: Terraform Init | |
run: terraform init | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Terraform Validate | |
id: validate | |
run: terraform validate -no-color | |
- name: Terraform apply | |
run: terraform apply -no-color -auto-approve &> /dev/null | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: eu-central-1 | |
# TODO Temporary workaround the fact that the lambda takes a bit to update | |
# so to avoid calling the old deployment, we want 20 seconds | |
# the 20 seconds is not a meaningful value, it is a random delay | |
# it might or might not be enough. This is just an hack until we add a solution for this | |
# e.g lambda versions? | |
wait-aws-update: | |
runs-on: ubuntu-latest | |
needs: [terraform] | |
steps: | |
- name: Sleep for 20 seconds | |
run: sleep 20s | |
shell: bash | |
# Migrate the database | |
migrate-pycon-backend-db: | |
runs-on: ubuntu-latest | |
needs: [terraform, wait-aws-update] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.ref }} | |
- name: Migrate PyCon Backend DB | |
run: | | |
aws lambda invoke --function-name ${{ env.TF_WORKSPACE }}-pycon-backend --cli-binary-format raw-in-base64-out --payload '{ "_serverless-wsgi": { "command": "manage", "data": "migrate" } }' response.json | |
cat response.json | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} |