# GENERATED BY ./post_publish.ts -- DO NOT DIRECTLY EDIT

name: post_publish
on:
  release:
    types:
      - published
jobs:
  update-dl-version:
    name: update dl.deno.land version
    if: github.repository == 'denoland/deno'
    runs-on: ubuntu-latest
    steps:
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
      - uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282
        with:
          deno-version: v2.x
      - name: Authenticate with Google Cloud
        uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093
        with:
          project_id: denoland
          credentials_json: '${{ secrets.GCP_SA_KEY }}'
          export_environment_variables: true
          create_credentials_file: true
      - name: Setup gcloud
        uses: google-github-actions/setup-gcloud@aa5489c8933f4cc7a4f7d45035b3b1440c9c10db
        with:
          project_id: denoland
      - name: Upload version file to dl.deno.land
        env:
          AWS_ACCESS_KEY_ID: '${{ vars.S3_ACCESS_KEY_ID }}'
          AWS_SECRET_ACCESS_KEY: '${{ secrets.S3_SECRET_ACCESS_KEY }}'
          AWS_ENDPOINT_URL_S3: '${{ vars.S3_ENDPOINT }}'
          AWS_DEFAULT_REGION: '${{vars.S3_REGION }}'
        run: |-
          VERSION=${GITHUB_REF#refs/*/}
          deno run --allow-net --allow-write tools/release/update_versions_json.ts "$VERSION"
          aws s3 cp versions.json s3://dl-deno-land/versions.json --content-type application/json
          LATEST_FILE=$(deno run --allow-net --allow-write tools/release/upload_version_file.ts "$VERSION" || exit 0)
          [ -z "$LATEST_FILE" ] && exit 0
          aws s3 cp "$LATEST_FILE" "s3://dl-deno-land/$LATEST_FILE"

# gagen:pin actions/checkout@v6 = de0fac2e4500dabe0009e67214ff5f5447ce83dd
# gagen:pin denoland/setup-deno@v2 = 667a34cdef165d8d2b2e98dde39547c9daac7282
# gagen:pin google-github-actions/auth@v3 = 7c6bc770dae815cd3e89ee6cdf493a5fab2cc093
# gagen:pin google-github-actions/setup-gcloud@v3 = aa5489c8933f4cc7a4f7d45035b3b1440c9c10db
