From c8450b10f975bbe235b1b2ca11a1847a707c7dab Mon Sep 17 00:00:00 2001 From: Daniel Gross Date: Tue, 17 Dec 2024 15:50:03 -0500 Subject: [PATCH] Delete GH action to generate files for all locales --- .github/workflows/generate_dist_locales.yml | 144 -------------------- 1 file changed, 144 deletions(-) delete mode 100644 .github/workflows/generate_dist_locales.yml diff --git a/.github/workflows/generate_dist_locales.yml b/.github/workflows/generate_dist_locales.yml deleted file mode 100644 index eb87e59fe..000000000 --- a/.github/workflows/generate_dist_locales.yml +++ /dev/null @@ -1,144 +0,0 @@ -name: Generate distribution files for all locales - -on: - workflow_dispatch: - push: - branches: - - main - -concurrency: - group: "full_dist" - cancel-in-progress: true - -permissions: - contents: write - pull-requests: write - -jobs: - generate_locales: - if: github.repository_owner == 'Shopify' - runs-on: ubuntu-latest - outputs: - LOCALES: ${{ steps.retrieve_locales.outputs.locales }} - steps: - - uses: actions/checkout@v4 - - name: Retrieve Locales - id: retrieve_locales - run: | - locales=$(ls data/localizations/categories/ | grep -Eo '^[a-z]{2,3}(-[A-Z]{2})?' | uniq | xargs) - locales_json=$(echo -n "["; for locale in $locales; do echo -n "\"$locale\","; done | sed 's/,$//'; echo -n "]") - echo "locales=$locales_json" >> $GITHUB_OUTPUT - - generate_distribution_files: - needs: generate_locales - runs-on: ubuntu-latest - strategy: - matrix: - locale: ${{ fromJson(needs.generate_locales.outputs.LOCALES) }} - steps: - - uses: actions/checkout@v4 - - # Setup dependencies - - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true - - uses: cue-lang/setup-cue@v1.0.0 - with: - version: 'v0.7.0' - - name: Install b3sum - run: | - curl -L https://github.com/BLAKE3-team/BLAKE3/releases/download/1.5.3/b3sum_linux_x64_bin -o b3sum - chmod +x b3sum - sudo mv b3sum /usr/local/bin/ - - # Generate distribution files - - name: Generate local-specific distribution files - run: VERBOSE=1 LOCALES=${{ matrix.locale }} make --file=Makefile build - - # Create manifest and upload everything - - name: Create distribution manifest - run: | - target="dist/${{ matrix.locale }}" - manifest="${{ matrix.locale }}_manifest.b3" - manifest_sig="${manifest}.sig" - - find "$target" -type f -print0 | sort -z | xargs -0 b3sum > "$manifest" - echo -n "${{ secrets.MANIFEST_KEY }}" | b3sum --keyed "$manifest" > "$manifest_sig" - - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.locale }} - path: | - dist/${{ matrix.locale }}/ - ${{ matrix.locale }}_manifest.b3 - ${{ matrix.locale }}_manifest.b3.sig - - create_pull_request: - needs: generate_distribution_files - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 - with: - path: . - merge-multiple: true - - name: Install b3sum - run: | - curl -L https://github.com/BLAKE3-team/BLAKE3/releases/download/1.5.3/b3sum_linux_x64_bin -o b3sum - chmod +x b3sum - sudo mv b3sum /usr/local/bin/ - - name: Verify file integrity - run: | - find dist -maxdepth 1 -mindepth 1 -type d | while read -r locale_path; do - locale=$(basename "$locale_path") - manifest="${locale}_manifest.b3" - manifest_sig="${manifest}.sig" - verify_sig="${locale}_verify.b3.sig" - - echo -n "${{ secrets.MANIFEST_KEY }}" | b3sum --keyed "$manifest" > "$verify_sig" - - echo "Vetting $manifest_sig with generated $verify_sig" - if ! (cmp -s "$manifest_sig" "$verify_sig"); then - echo "Error: Integrity failure for ${locale}. Invalid key used to generate ${verify_sig}." - exit 1 - fi - rm -f "$manifest_sig" "$verify_sig" - - echo "Vetting $manifest" - if ! (b3sum --check "$manifest"); then - echo "Error: Integrity failure for ${locale}. Files are inconsistent with ${manifest}." - exit 1 - fi - rm -f "$manifest" - done - - # Check for any remaining manifest files - unchecked_manifests=$(find . -maxdepth 1 -name '*_manifest.b3') - if [ -n "$unchecked_manifests" ]; then - echo "Error: Unchecked manifest files found:" - echo "$unchecked_manifests" - exit 1 - fi - - - name: Set up short SHA - id: short_sha - run: echo "sha=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_OUTPUT - - name: Get last commit author username - id: last_committer - run: | - LAST_COMMIT_SHA=$(git log -1 --pretty=format:'%H') - API_URL="https://api.github.com/repos/${{ github.repository }}/commits/${LAST_COMMIT_SHA}" - AUTHOR_LOGIN=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" $API_URL | jq -r '.author.login') - echo "username=$AUTHOR_LOGIN" >> $GITHUB_OUTPUT - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Commit changes and create PR - uses: peter-evans/create-pull-request@v6 - with: - commit-message: "🤖 Update localization files for ${{ github.sha }}" - branch: "localization-dist" - title: "🤖 Update localization files" - body: | - Update `dist/` localization files. Triggered by ${{ steps.short_sha.outputs.sha }}. - cc @${{ steps.last_committer.outputs.username }} - labels: automated-pr, localization - reviewers: ${{ steps.last_committer.outputs.username }}