<commit_before>name: On version tag

on:
  push:
    tags:
      - v* # Push events matching v*, e.g. v2.0.0.

jobs:
  build_frontend:
    runs-on: ubuntu-latest

    steps:
    - name: Get the version
      id: get_version
      run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}    
    - uses: actions/checkout@v2
    - uses: docker/build-push-action@v1
      with:
        username: ${{ secrets.DockerUsername }}
        password: ${{ <PASSWORD> }}
        repository: collaction/frontend
        tags: ${{ steps.get_version.outputs.VERSION }}
        dockerfile: Frontend/Dockerfile
        path: Frontend

  build_backend:
    runs-on: ubuntu-latest

    steps:
    - name: Get the version
      id: get_version
      run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}    

    - uses: actions/checkout@v2

    - uses: docker/build-push-action@v1
      with:
        username: ${{ secrets.DockerUsername }}
        password: ${{ secrets.<PASSWORD> }}
        repository: collaction/backend
        tags: ${{ steps.get_version.outputs.VERSION }}
        dockerfile: CollAction/Dockerfile

    - uses: hashicorp/setup-terraform@v1
      with:
        cli_config_credentials_token: ${{ secrets.TERRAFORM_CLOUD_API_TOKEN }}

    - name: Terraform Init
      working-directory: ./Terraform/staging
      run: terraform init

    - name: Terraform Format
      working-directory: ./Terraform/staging
      run: terraform fmt -check

    - name: Terraform Plan
      working-directory: ./Terraform/staging
      run: terraform plan

    - name: Terraform Apply
      working-directory: ./Terraform/staging
      if: github.ref == 'refs/heads/master' && github.event_name == 'push'
      run: terraform apply -auto-approve -var 'imageversion=${{ steps.get_version.outputs.VERSION }}'<commit_msg>Pass AWS credentials<commit_after>name: On version tag

on:
  push:
    tags:
      - v* # Push events matching v*, e.g. v2.0.0.

jobs:
  build_frontend:
    runs-on: ubuntu-latest

    steps:
    - name: Get the version
      id: get_version
      run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}    
    - uses: actions/checkout@v2
    - uses: docker/build-push-action@v1
      with:
        username: ${{ secrets.DockerUsername }}
        password: ${{ <PASSWORD> }}
        repository: collaction/frontend
        tags: ${{ steps.get_version.outputs.VERSION }}
        dockerfile: Frontend/Dockerfile
        path: Frontend

  build_backend:
    runs-on: ubuntu-latest

    steps:
    - name: Get the version
      id: get_version
      run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}    

    - uses: actions/checkout@v2

    - uses: docker/build-push-action@v1
      with:
        username: ${{ secrets.DockerUsername }}
        password: ${{ <PASSWORD> }}
        repository: collaction/backend
        tags: ${{ steps.get_version.outputs.VERSION }}
        dockerfile: CollAction/Dockerfile

    - uses: hashicorp/setup-terraform@v1
      with:
        cli_config_credentials_token: ${{ secrets.TERRAFORM_CLOUD_API_TOKEN }}

    - name: Terraform Init
      working-directory: ./Terraform/staging
      run: terraform init

    - name: Terraform Format
      working-directory: ./Terraform/staging
      run: terraform fmt -check

    - name: Terraform Plan
      working-directory: ./Terraform/staging
      run: terraform plan
      env:
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}      

    - name: Terraform Apply
      working-directory: ./Terraform/staging
      if: github.ref == 'refs/heads/master' && github.event_name == 'push'
      run: terraform apply -auto-approve -var 'imageversion=${{ steps.get_version.outputs.VERSION }}'
      env:
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}      
{'fraction_non_alphanumeric': 0.11957349581111958, 'fraction_numerical': 0.004061944656004062, 'mean_word_length': 2.456140350877193, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2870362', 'n_tokens_mistral': 1310, 'n_tokens_neox': 1259, 'n_words': 256}