Skip to content

Commit 63cdf12

Browse files
authored
repo sync
2 parents 6917970 + 7ec73b3 commit 63cdf12

File tree

20 files changed

+280
-90
lines changed

20 files changed

+280
-90
lines changed

content/actions/guides/deploying-to-amazon-elastic-container-service.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ product: '{% data reusables.gated-features.actions %}'
55
versions:
66
free-pro-team: '*'
77
enterprise-server: '>=2.22'
8+
type: 'tutorial'
89
---
910

1011
{% data reusables.actions.enterprise-beta %}

content/actions/guides/deploying-to-azure-app-service.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ product: '{% data reusables.gated-features.actions %}'
55
versions:
66
free-pro-team: '*'
77
enterprise-server: '>=2.22'
8+
type: 'tutorial'
89
---
910

1011
{% data reusables.actions.enterprise-beta %}
@@ -54,7 +55,7 @@ Before creating your {% data variables.product.prodname_actions %} workflow, you
5455

5556
3. Configure an Azure publish profile and create an `AZURE_WEBAPP_PUBLISH_PROFILE` secret.
5657

57-
Generate your Azure deployment credentials using a publish profile. For more information, see "[Generate deployment credentials](https://docs.microsoft.com/en-us/azure/app-service/deploy-github-actions?tabs=applevel#generate-deployment-credentials)" in the Azure documentation.
58+
Generate your Azure deployment credentials using a publish profile. For more information, see "[Generate deployment credentials](https://docs.microsoft.com/en-us/azure/app-service/deploy-github-actions?tabs=applevel#generate-deployment-credentials)" in the Azure documentation.
5859

5960
In your {% data variables.product.prodname_dotcom %} repository, create a secret named `AZURE_WEBAPP_PUBLISH_PROFILE` that contains the contents of the publish profile. For more information on creating secrets, see "[Encrypted secrets](/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository)."
6061

content/actions/guides/deploying-to-google-kubernetes-engine.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ product: '{% data reusables.gated-features.actions %}'
55
versions:
66
free-pro-team: '*'
77
enterprise-server: '>=2.22'
8+
type: 'tutorial'
89
---
910

1011
{% data reusables.actions.enterprise-beta %}
@@ -99,37 +100,37 @@ The following example workflow demonstrates how to build a container image and p
99100
{% raw %}
100101
```yaml{:copy}
101102
name: Build and Deploy to GKE
102-
103+
103104
on:
104105
release:
105106
types: [created]
106-
107+
107108
env:
108109
PROJECT_ID: ${{ secrets.GKE_PROJECT }}
109110
GKE_CLUSTER: cluster-1 # Add your cluster name here.
110111
GKE_ZONE: us-central1-c # Add your cluster zone here.
111112
DEPLOYMENT_NAME: gke-test # Add your deployment name here.
112113
IMAGE: static-site
113-
114+
114115
jobs:
115116
setup-build-publish-deploy:
116117
name: Setup, Build, Publish, and Deploy
117118
runs-on: ubuntu-latest
118119
steps:
119-
120+
120121
- name: Checkout
121122
uses: actions/checkout@v2
122-
123+
123124
# Setup gcloud CLI
124125
- uses: google-github-actions/setup-gcloud@v0.2.0
125126
with:
126127
service_account_key: ${{ secrets.GKE_SA_KEY }}
127128
project_id: ${{ secrets.GKE_PROJECT }}
128-
129+
129130
# Configure docker to use the gcloud command-line tool as a credential helper
130131
- run: |-
131132
gcloud --quiet auth configure-docker
132-
133+
133134
# Get the GKE credentials so we can deploy to the cluster
134135
- uses: google-github-actions/get-gke-credentials@v0.2.1
135136
with:
@@ -145,18 +146,18 @@ jobs:
145146
--build-arg GITHUB_SHA="$GITHUB_SHA" \
146147
--build-arg GITHUB_REF="$GITHUB_REF" \
147148
.
148-
149+
149150
# Push the Docker image to Google Container Registry
150151
- name: Publish
151152
run: |-
152153
docker push "gcr.io/$PROJECT_ID/$IMAGE:$GITHUB_SHA"
153-
154+
154155
# Set up kustomize
155156
- name: Set up Kustomize
156157
run: |-
157158
curl -sfLo kustomize https://github.com/kubernetes-sigs/kustomize/releases/download/v3.1.0/kustomize_3.1.0_linux_amd64
158159
chmod u+x ./kustomize
159-
160+
160161
# Deploy the Docker image to the GKE cluster
161162
- name: Deploy
162163
run: |-

content/actions/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ changelog:
3636
href: https://github.blog/changelog/2020-10-29-github-actions-ubuntu-latest-workflows-will-use-ubuntu-20-04
3737

3838
product_video: https://www.youtube-nocookie.com/embed/cP0I9w2coGU
39-
39+
4040
redirect_from:
4141
- /articles/automating-your-workflow-with-github-actions/
4242
- /articles/customizing-your-project-with-github-actions/
@@ -72,7 +72,7 @@ versions:
7272
{% render 'code-example-card' for actionsCodeExamples as example %}
7373
</div>
7474

75-
<button class="js-filter-card-show-more btn btn-outline float-right">Show more {% octicon "arrow-right" %}</button>
75+
<button class="js-filter-card-show-more btn btn-outline float-right" data-js-filter-card-max="6">Show more {% octicon "arrow-right" %}</button>
7676

7777
<div class="js-filter-card-no-results d-none py-4 text-center text-gray font-mktg">
7878
<div class="mb-3">{% octicon "search" width="24" %}</div>

content/discussions/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ versions:
4343
{% render 'discussions-community-card' for discussionsCommunityExamples as example %}
4444
</div>
4545
{% if discussionsCommunityExamples.length > 6 %}
46-
<button class="js-filter-card-show-more btn btn-outline float-right">Show more {% octicon "arrow-right" %}</button>
46+
<button class="js-filter-card-show-more btn btn-outline float-right" data-js-filter-card-max="6">Show more {% octicon "arrow-right" %}</button>
4747
{% endif %}
4848
<div class="js-filter-card-no-results d-none py-4 text-center text-gray font-mktg">
4949
<div class="mb-3">{% octicon "search" width="24" %}</div>

data/ui.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,13 @@ product_sublanding:
148148
learning_paths: Learning paths
149149
learning_paths_desc: Learning paths are a collection of guides that help you master a particular subject.
150150
more_guides: more guides
151-
guideTypes:
151+
load_more: Load more guides
152+
all_guides: All Guides
153+
no_result: Sorry, there is no guide that match your filter.
154+
filters:
155+
type: Type
156+
all: All
157+
guide_types:
152158
overview: Overview
153159
quick_start: Quickstart
154160
tutorial: Tutorial

includes/article-cards.html

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{% assign currentCategory = siteTree[currentLanguage][currentVersion].products[currentProduct].categories[breadcrumbs.category.href] %}
2+
3+
{% assign maxArticles = 9 %}
4+
5+
<div class="container-xl px-3 px-md-6 pt-3 pb-2">
6+
<h2 class="mb-3 font-mktg">{% data ui.product_sublanding.all_guides %}</h2>
7+
8+
<form class="my-2">
9+
<label for="type" class="text-uppercase f6 text-gray d-block">{% data ui.product_sublanding.filters.type %}</label>
10+
<select class="form-select js-filter-card-filter-dropdown f4 text-bold border-0 rounded-0 border-top box-shadow-none pl-0 js-filter-card-filter-dropdown" name="type" aria-label="guide types">
11+
<option value="">{% data ui.product_sublanding.filters.all %}</option>
12+
{% for type in site.data.ui.product_sublanding.guide_types %}
13+
<option value="{{ type[0] }}">{{ type[1] }}</option>
14+
{% endfor %}
15+
16+
</select>
17+
</form>
18+
19+
20+
<div class="d-flex flex-wrap mr-0 mr-md-n6 mr-lg-n8">
21+
{% for article in currentCategory.articles %}
22+
23+
{% assign card_display_class = "" %}
24+
{% if forloop.index > maxArticles %}
25+
{% assign card_display_class = "d-none" %}
26+
{% endif %}
27+
28+
{% capture link_card %}
29+
{% link_as_article_card {{ article[1].href }} %}
30+
{% endcapture %}
31+
32+
{{ link_card | replace: "<display condition>", card_display_class }}
33+
{% endfor %}
34+
35+
<button class="col-12 mt-5 text-center text-bold text-blue btn-link js-filter-card-show-more" data-js-filter-card-max="{{ maxArticles }}">
36+
{% data ui.product_sublanding.load_more %}
37+
</button>
38+
39+
<div class="js-filter-card-no-results d-none py-4 text-center text-gray">
40+
<h4 class="text-normal">{% data ui.product_sublanding.no_result %}</h4>
41+
</div>
42+
</div>
43+
</div>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<div class="d-flex col-12 col-md-4 pr-0 pr-md-6 pr-lg-8 <display condition> js-filter-card" data-type="{{ type }}">
2+
<a class="no-underline d-flex flex-column py-4 border-bottom" href="{{ fullPath }}">
3+
<h4 class="h4 text-gray-dark mb-1">{{ title }}</h4>
4+
<div class="text-purple h6 text-uppercase">{{ type }}</div>
5+
<p class="text-gray my-3">{{ intro }}</p>
6+
</a>
7+
</div>

javascripts/filter-cards.js

Lines changed: 81 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,104 @@
1-
function filterCards (cards, value) {
1+
function matchCardBySearch (card, searchString) {
2+
const matchReg = new RegExp(searchString, 'i')
3+
// Check if this card matches - any `data-*` attribute contains the string
4+
return Object.keys(card.dataset).some(key => matchReg.test(card.dataset[key]))
5+
}
6+
7+
function matchCardByAttribute (card, attribute, value) {
8+
if (attribute in card.dataset) {
9+
return card.dataset[attribute] === value
10+
}
11+
return false
12+
}
13+
14+
export default function cardsFilter () {
15+
const inputFilter = document.querySelector('.js-filter-card-filter')
16+
const dropdownFilter = document.querySelector('.js-filter-card-filter-dropdown')
17+
const cards = Array.from(document.querySelectorAll('.js-filter-card'))
18+
const showMoreButton = document.querySelector('.js-filter-card-show-more')
219
const noResults = document.querySelector('.js-filter-card-no-results')
3-
const matchReg = new RegExp(value, 'i')
20+
// if jsFilterCardMax not set, assume no limit (well, at 99)
21+
const maxCards = showMoreButton ? parseInt(showMoreButton.dataset.jsFilterCardMax || 99) : null
422

5-
// Track whether or not we had at least one match
6-
let hasMatches = false
23+
const filterEventHandler = (evt) => {
24+
const { currentTarget } = evt
25+
const value = currentTarget.value
726

8-
for (let index = 0; index < cards.length; index++) {
9-
const card = cards[index]
27+
// Show or hide the "Show more" button if there is a value
28+
if (value) {
29+
showMoreButton.classList.add('d-none')
30+
} else {
31+
showMoreButton.classList.remove('d-none')
32+
}
1033

11-
// Filter was emptied
12-
if (!value) {
13-
// Make sure we don't show the "No results" blurb
14-
hasMatches = true
34+
// Track whether or not we had at least one match
35+
let hasMatches = false
1536

16-
// Hide all but the first 6
17-
if (index > 5) {
18-
card.classList.add('d-none')
19-
} else {
20-
card.classList.remove('d-none')
37+
for (let index = 0; index < cards.length; index++) {
38+
const card = cards[index]
39+
40+
// Filter was emptied
41+
if (!value) {
42+
// Make sure we don't show the "No results" blurb
43+
hasMatches = true
44+
45+
// Hide all but the first n number of cards
46+
if (index > maxCards - 1) {
47+
card.classList.add('d-none')
48+
} else {
49+
card.classList.remove('d-none')
50+
}
51+
52+
continue
2153
}
2254

23-
continue
24-
}
55+
let cardMatches = false
2556

26-
// Check if this card matches - any `data-*` attribute contains the string
27-
const cardMatches = Object.keys(card.dataset)
28-
.some(key => matchReg.test(card.dataset[key]))
57+
if (currentTarget.tagName === 'INPUT') {
58+
cardMatches = matchCardBySearch(card, value)
59+
}
60+
61+
if (currentTarget.tagName === 'SELECT' && currentTarget.name) {
62+
cardMatches = matchCardByAttribute(card, currentTarget.name, value)
63+
}
64+
65+
if (cardMatches) {
66+
card.classList.remove('d-none')
67+
hasMatches = true
68+
} else {
69+
card.classList.add('d-none')
70+
}
71+
}
2972

30-
if (cardMatches) {
31-
card.classList.remove('d-none')
32-
hasMatches = true
73+
// If there wasn't at least one match, show the "no results" text
74+
if (!hasMatches) {
75+
noResults.classList.remove('d-none')
3376
} else {
34-
card.classList.add('d-none')
77+
noResults.classList.add('d-none')
3578
}
36-
}
3779

38-
// If there wasn't at least one match, show the "no results" text
39-
if (!hasMatches) {
40-
document.querySelector('.js-filter-card-value').textContent = value
41-
noResults.classList.remove('d-none')
42-
} else {
43-
noResults.classList.add('d-none')
80+
return hasMatches
4481
}
45-
}
46-
47-
export default function filterCodeExamples () {
48-
const filter = document.querySelector('.js-filter-card-filter')
49-
const cards = Array.from(document.querySelectorAll('.js-filter-card'))
50-
const showMoreButton = document.querySelector('.js-filter-card-show-more')
51-
52-
if (filter) {
53-
filter.addEventListener('keyup', evt => {
54-
const value = evt.currentTarget.value
5582

56-
// Show or hide the "Show more" button if there is a value
57-
if (value) showMoreButton.classList.add('d-none')
58-
else showMoreButton.classList.remove('d-none')
59-
60-
filterCards(cards, value)
83+
if (inputFilter) {
84+
inputFilter.addEventListener('keyup', (evt) => {
85+
const hasMatches = filterEventHandler(evt)
86+
if (!hasMatches) {
87+
document.querySelector('.js-filter-card-value').textContent = evt.currentTarget.value
88+
}
6189
})
6290
}
6391

92+
if (dropdownFilter) {
93+
dropdownFilter.addEventListener('change', filterEventHandler)
94+
}
95+
6496
if (showMoreButton) {
6597
showMoreButton.addEventListener('click', evt => {
6698
// Number of cards that are currently visible
6799
const numShown = cards.filter(card => !card.classList.contains('d-none')).length
68-
// We want to show 6 more
69-
const totalToShow = numShown + 6
100+
// We want to show n more cards
101+
const totalToShow = numShown + maxCards
70102

71103
for (let index = numShown; index < cards.length; index++) {
72104
const card = cards[index]
@@ -83,7 +115,7 @@ export default function filterCodeExamples () {
83115

84116
// They're all shown now, we should hide the button
85117
if (totalToShow >= cards.length) {
86-
evt.currentTarget.style.display = 'none'
118+
evt.currentTarget.classList.add('d-none')
87119
}
88120
})
89121
}

javascripts/show-more.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* This utility makes it easy to implement a list of items, some of which are hidden initially
2+
* This utility component implement a list of items, some of which are hidden initially
33
* until user clicks "show more".
44
*
55
* Example:

0 commit comments

Comments
 (0)