Skip to content

Commit

Permalink
Close #3186 Use Composer to track az-icons package, and add ability f…
Browse files Browse the repository at this point in the history
…or site owner to choose how az-icon library is loaded. (#1465)


Co-authored-by: Brian Berndt <[email protected]>
  • Loading branch information
trackleft and bberndt-uaz authored Feb 23, 2024
1 parent 9885c9a commit 7f01034
Show file tree
Hide file tree
Showing 53 changed files with 81 additions and 320 deletions.
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.1",
"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 Icons minified.
if (theme_get_setting('az_icons_minified')) {
$az_icons_path .= '.min';
}
$az_icons_path .= '.css';

return $az_icons_path;
}
Expand Down
2 changes: 2 additions & 0 deletions themes/custom/az_barrio/config/install/az_barrio.settings.yml
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_icons_minified: true
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_icons_minified:
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.1');

/**
* 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

0 comments on commit 7f01034

Please sign in to comment.