<commit_before>name: Build and publish

on:
  push:
    branches:
      - master
    tags:
      - '*'

jobs:
  push_to_registry:
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2
      -
        name: Docker meta
        id: meta
        uses: docker/metadata-action@v3
        with:
          # list of Docker images to use as base name for tags
          images: |
            pppy/osu-web
          # generate Docker tags based on the following events/attributes
          # on tag event: tag using git tag, and as latest if the tag doesn't contain hyphens (pre-releases)
          # on push event: tag using git sha
          tags: |
            type=raw,value=latest,enable=${{ github.ref_type == 'tag' && !contains(github.ref_name, '-') }}
            type=raw,value=${{ github.ref_name }}
            type=raw,value=${{ github.sha }},enable=${{ github.ref_type == 'branch' }}
          flavor: |
            latest=false
      -
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1
      -
        name: Login to DockerHub
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}
      -
        name: Build and push
        uses: docker/build-push-action@v2
        with:
          build-args: |
            "APP_URL=https://osu.ppy.sh"
            "DOCS_URL=https://osu.ppy.sh/docs/"
            "GIT_SHA=osu-web@${{ (github.ref_type == 'tag' && github.ref_name) || github.sha }}"
          context: .
          file: ./Dockerfile.deployment
          platforms: linux/amd64
          push: true
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}

  push_to_production:
    if: ${{ github.ref_type == 'tag' }}
    runs-on: ubuntu-latest
    needs:
      - push_to_registry
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2
      # production deploy is handled manually, only releasing to Sentry
      -
        name: Create Sentry release
        uses: getsentry/action-release@v1
        env:
          SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
          SENTRY_ORG: ppy
          SENTRY_PROJECT: osu-web
          SENTRY_URL: https://sentry.ppy.sh/
        with:
          environment: production
          version: osu-web@${{ github.ref_name }}

  push_to_staging:
    if: ${{ github.ref_type == 'branch' }}
    runs-on: ubuntu-latest
    needs:
      - push_to_registry
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2
      -
        name: Repository Dispatch
        uses: peter-evans/repository-dispatch@v2
        with:
          token: ${{ secrets.KUBERNETES_CONFIG_REPO_ACCESS_TOKEN }}
          repository: ppy/osu-kubernetes-config
          event-type: dev-ppy-sh-deploy
          client-payload: '{"tag": "${{ github.sha }}"}'
      -
        name: Create Sentry release
        uses: getsentry/action-release@v1
        env:
          SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
          SENTRY_ORG: ppy
          SENTRY_PROJECT: osu-web
          SENTRY_URL: https://sentry.ppy.sh/
        with:
          environment: staging
          version: osu-web@${{ github.sha }}
<commit_msg>👷 Tag Docker dev images as latest-dev<commit_after>name: Build and publish

on:
  push:
    branches:
      - master
    tags:
      - '*'

jobs:
  push_to_registry:
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2
      -
        name: Docker meta
        id: meta
        uses: docker/metadata-action@v3
        with:
          # list of Docker images to use as base name for tags
          images: |
            pppy/osu-web
          # generate Docker tags based on the following events/attributes
          # on tag event: tag using git tag, and as latest if the tag doesn't contain hyphens (pre-releases)
          # on push event: tag using git sha, branch name and as latest-dev
          tags: |
            type=raw,value=latest,enable=${{ github.ref_type == 'tag' && !contains(github.ref_name, '-') }}
            type=raw,value=latest-dev,enable=${{ github.ref_type == 'branch' }}
            type=raw,value=${{ github.ref_name }}
            type=raw,value=${{ github.sha }},enable=${{ github.ref_type == 'branch' }}
          flavor: |
            latest=false
      -
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1
      -
        name: Login to DockerHub
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ <PASSWORD> }}
      -
        name: Build and push
        uses: docker/build-push-action@v2
        with:
          build-args: |
            "APP_URL=https://osu.ppy.sh"
            "DOCS_URL=https://osu.ppy.sh/docs/"
            "GIT_SHA=osu-web@${{ (github.ref_type == 'tag' && github.ref_name) || github.sha }}"
          context: .
          file: ./Dockerfile.deployment
          platforms: linux/amd64
          push: true
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}

  push_to_production:
    if: ${{ github.ref_type == 'tag' }}
    runs-on: ubuntu-latest
    needs:
      - push_to_registry
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2
      # production deploy is handled manually, only releasing to Sentry
      -
        name: Create Sentry release
        uses: getsentry/action-release@v1
        env:
          SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
          SENTRY_ORG: ppy
          SENTRY_PROJECT: osu-web
          SENTRY_URL: https://sentry.ppy.sh/
        with:
          environment: production
          version: osu-web@${{ github.ref_name }}

  push_to_staging:
    if: ${{ github.ref_type == 'branch' }}
    runs-on: ubuntu-latest
    needs:
      - push_to_registry
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2
      -
        name: Repository Dispatch
        uses: peter-evans/repository-dispatch@v2
        with:
          token: ${{ secrets.KUBERNETES_CONFIG_REPO_ACCESS_TOKEN }}
          repository: ppy/osu-kubernetes-config
          event-type: dev-ppy-sh-deploy
          client-payload: '{"tag": "${{ github.sha }}"}'
      -
        name: Create Sentry release
        uses: getsentry/action-release@v1
        env:
          SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
          SENTRY_ORG: ppy
          SENTRY_PROJECT: osu-web
          SENTRY_URL: https://sentry.ppy.sh/
        with:
          environment: staging
          version: osu-web@${{ github.sha }}

{'fraction_non_alphanumeric': 0.11423054070112894, 'fraction_numerical': 0.0035650623885918, 'mean_word_length': 1.7984206151288447, 'pattern_counts': {'":': 2, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 8, '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': '6783505', 'n_tokens_mistral': 2147, 'n_tokens_neox': 2059, 'n_words': 456}