-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #200 from Shopify/cleanup-gh-actions
Tidying up our Actions
- Loading branch information
Showing
16 changed files
with
263 additions
and
376 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
name: Deploy GitHub page | ||
name: Deploy docs site | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
@@ -19,25 +19,15 @@ jobs: | |
generate_docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
|
||
- name: Install Cue | ||
uses: cue-lang/[email protected] | ||
- uses: actions/checkout@v4 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
bundler-cache: true | ||
- uses: cue-lang/[email protected] | ||
with: | ||
version: 'v0.7.0' | ||
|
||
- name: Install bundler and gems | ||
run: | | ||
gem install bundler | ||
bundle install --jobs 4 --retry 3 | ||
- name: Generate dist & docs | ||
run: make VERBOSE=1 | ||
|
||
- name: Upload data | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
|
@@ -48,29 +38,19 @@ jobs: | |
runs-on: ubuntu-latest | ||
needs: generate_docs | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download data | ||
uses: actions/download-artifact@v4 | ||
- uses: actions/checkout@v4 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: data | ||
path: docs/_data | ||
|
||
- name: Setup Pages | ||
uses: actions/configure-pages@v4 | ||
|
||
- name: Build with Jekyll | ||
uses: actions/jekyll-build-pages@v1 | ||
- uses: actions/configure-pages@v4 | ||
- uses: actions/jekyll-build-pages@v1 | ||
with: | ||
source: docs | ||
destination: _site | ||
|
||
- name: Copy search indexes | ||
run: sudo bin/copy_docs_search_indexes | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
- uses: actions/upload-pages-artifact@v3 | ||
|
||
deploy: | ||
environment: | ||
|
@@ -79,6 +59,5 @@ jobs: | |
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
- uses: actions/deploy-pages@v4 | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
name: Ensure distribution files committed are up-to-date | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
permissions: | ||
issues: write | ||
|
@@ -13,30 +13,19 @@ jobs: | |
ensure_dist_committed: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
|
||
- name: Install Cue | ||
uses: cue-lang/[email protected] | ||
- uses: actions/checkout@v4 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
bundler-cache: true | ||
- uses: cue-lang/[email protected] | ||
with: | ||
version: 'v0.7.0' | ||
|
||
- name: Install bundler and gems | ||
run: | | ||
gem install bundler | ||
bundle install --jobs 4 --retry 3 | ||
- name: Generate distribution files | ||
run: make VERBOSE=1 | ||
|
||
- name: Ensure there are no uncommitted distrubtion file changes | ||
id: ensure-dist-committed | ||
run: | | ||
git diff --exit-code || (echo "Please commit the changes made by the build process" && exit 1) | ||
- name: Inform PR author of failure and path to fix | ||
if: ${{ failure() && steps.ensure-dist-committed.outcome == 'failure' }} | ||
run: | | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
name: Generate and commit distribution files | ||
name: Generate and commit distribution files to requested PR | ||
|
||
on: | ||
workflow_dispatch: | ||
issue_comment: | ||
types: [created, edited] | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: "dist" | ||
|
@@ -17,31 +17,20 @@ jobs: | |
runs-on: ubuntu-latest | ||
if: ${{ github.event.issue.pull_request && github.event.comment.body == '/generate_dist' }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- uses: actions/checkout@v4 | ||
- name: Checkout PR | ||
run: gh pr checkout $ISSUE | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
ISSUE: ${{ github.event.issue.html_url }} | ||
|
||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
|
||
- name: Install Cue | ||
uses: cue-lang/[email protected] | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
bundler-cache: true | ||
- uses: cue-lang/[email protected] | ||
with: | ||
version: 'v0.7.0' | ||
|
||
- name: Install bundler and gems | ||
run: | | ||
gem install bundler | ||
bundle install --jobs 4 --retry 3 | ||
- name: Generate distribution files | ||
run: make VERBOSE=1 | ||
|
||
- name: Commit distribution files | ||
run: | | ||
git config --local user.name "GitHub Action" | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
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: | ||
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 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
bundler-cache: true | ||
- uses: cue-lang/[email protected] | ||
with: | ||
version: 'v0.7.0' | ||
- name: Generate local-specific distribution files | ||
run: make VERBOSE=1 LOCALES=${{ matrix.locale }} | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.locale }} | ||
path: dist/${{ matrix.locale }} | ||
|
||
create_pull_request: | ||
needs: generate_distribution_files | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
path: dist | ||
- 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 }} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.