Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close #3186 Use Composer to track az-icons package, and add ability for site owner to choose how az-icon library is loaded. #1465

Merged
merged 20 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/az-icons-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Create PR for new Arizona Icons release
run-name: Create PR to update Arizona Icons to ${{ github.event.client_payload.version }}.
on:
repository_dispatch:
types: az_icons_release

jobs:
release:
name: Create PR
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
# with:
# ssh-key: ${{ secrets.SELF_DEPLOY_KEY }}

- name: Create new branch and PR
run: |
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config --global user.name "${GITHUB_ACTOR}"
git checkout -b 'az-icons-${{ github.event.client_payload.version }}'
jq --indent 4 '.require."az-digital/az-icons" |= "${{ github.event.client_payload.version }}"' composer.json > composer.json.new
mv composer.json.new composer.json
cat themes/custom/az_barrio/includes/common.inc | sed "s/^define('AZ_ICONS_STABLE_VERSION'.*/define('AZ_ICONS_STABLE_VERSION', '${{ github.event.client_payload.version }}');/g" > common.inc.new
mv common.inc.new themes/custom/az_barrio/includes/common.inc
git add composer.json themes/custom/az_barrio/includes/common.inc
git commit -m 'Update Arizona Icons to ${{ github.event.client_payload.version }}'
git push --set-upstream origin 'az-icons-${{ github.event.client_payload.version }}'
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
gh pr create --title 'Update Arizona Icons to ${{ github.event.client_payload.version }}' --body ''
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"require": {
"php": ">=8.1",
"az-digital/arizona-bootstrap": "2.0.25",
"az-digital/az-icons": "1.0.0",
trackleft marked this conversation as resolved.
Show resolved Hide resolved
trackleft marked this conversation as resolved.
Show resolved Hide resolved
"az-digital/smart_title": "dev-az-digital",
"citation-style-language/locales": "0.0.11",
"citation-style-language/styles": "0.0.343",
Expand Down
2 changes: 1 addition & 1 deletion themes/custom/az_barrio/az_barrio.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ az-proxima-nova:
az-icons:
css:
theme:
https://cdn.digital.arizona.edu/lib/az-icons/main/az-icons-styles.css: {}
/libraries/az-icons/az-icons-styles.min.css: {}
arizona-bootstrap:
css:
theme:
Expand Down
15 changes: 13 additions & 2 deletions themes/custom/az_barrio/az_barrio.theme
Original file line number Diff line number Diff line change
Expand Up @@ -384,14 +384,25 @@ function az_barrio_az_bootstrap_assets_path($type) {
*/
function az_barrio_az_icons_assets_path($type) {
$az_icons_path = '';
$az_icons_cdn_version = theme_get_setting('az_icons_cdn_version');
if ($az_icons_cdn_version === 'stable') {
$az_icons_cdn_version = AZ_ICONS_STABLE_VERSION;
}

// AZ Icons source.
if (theme_get_setting('az_barrio_az_icons_source') === 'cdn') {
$az_icons_path = 'https://cdn.digital.arizona.edu/lib/az-icons/' . AZ_ICONS_STABLE_VERSION . '/az-icons-styles.css';
$az_icons_path = 'https://cdn.digital.arizona.edu/lib/az-icons/' . $az_icons_cdn_version;
}
else {
$az_icons_path = 'libraries/az-icons/az-icons-styles.css';
$az_icons_path = base_path() . 'libraries/az-icons';
}
$az_icons_path .= '/az-icons-styles';

// AZ Bootstrap minified.
trackleft marked this conversation as resolved.
Show resolved Hide resolved
if (theme_get_setting('az_icons_minified')) {
$az_icons_path .= '.min';
}
$az_icons_path .= '.css';

return $az_icons_path;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ az_bootstrap_cdn_version: stable
az_bootstrap_minified: true
az_barrio_az_icons: true
az_barrio_az_icons_source: cdn
az_barrio_az_icons_minified: true
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this was set when I was reviewing.

trackleft marked this conversation as resolved.
Show resolved Hide resolved
az_icons_cdn_version: stable
external_links: true
sticky_footer: true
az_barrio_material_design_sharp_icons: true
Expand Down
10 changes: 8 additions & 2 deletions themes/custom/az_barrio/config/schema/az_barrio.schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,16 @@ az_barrio.settings:
label: 'Use Material Design Sharp Icons'
az_barrio_az_icons:
type: boolean
label: 'Use AZ Icons'
label: 'Use Arizona Icons'
az_barrio_az_icons_source:
type: string
label: 'AZ Icons source'
label: 'Arizona Icons source'
az_barrio_az_icons_minified:
trackleft marked this conversation as resolved.
Show resolved Hide resolved
type: boolean
label: 'Use minified version of Arizona Icons'
az_icons_cdn_version:
type: string
label: 'Arizona Icons CDN version'
sticky_footer:
type: boolean
label: 'Enable AZ Bootstrap sticky footer template'
Expand Down
2 changes: 1 addition & 1 deletion themes/custom/az_barrio/includes/common.inc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

define('AZ_BOOTSTRAP_STABLE_VERSION', '2.0.25');
define('AZ_ICONS_STABLE_VERSION', 'main');
define('AZ_ICONS_STABLE_VERSION', '1.0.0');
trackleft marked this conversation as resolved.
Show resolved Hide resolved

/**
* Persistent variable name for exporting the AZ Bootstrap CSS location.
Expand Down
87 changes: 0 additions & 87 deletions themes/custom/az_barrio/libraries/az-icons/az-icons-styles.css

This file was deleted.

Binary file not shown.
Loading