Skip to content

Commit

Permalink
Merge pull request #7 from theohbrothers/enhancement/bump-pagefind-1.…
Browse files Browse the repository at this point in the history
…0-variants-to-1.0.4

Enhancement: Bump pagefind 1.0 variants to 1.0.4
  • Loading branch information
theohbrothersbot authored Nov 17, 2023
2 parents ff5b749 + 4141cc6 commit 3f805a3
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 24 deletions.
42 changes: 21 additions & 21 deletions .github/workflows/ci-master-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: |
git diff --exit-code
build-1-0-3:
build-1-0-4:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -64,9 +64,9 @@ jobs:
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-1.0.3-${{ github.sha }}
key: ${{ runner.os }}-buildx-1.0.4-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-1.0.3-
${{ runner.os }}-buildx-1.0.4-
${{ runner.os }}-buildx-
- name: Login to Docker Hub registry
Expand All @@ -79,7 +79,7 @@ jobs:

# This step generates the docker tags
- name: Prepare
id: prep-1-0-3
id: prep-1-0-4
run: |
set -e
Expand All @@ -92,7 +92,7 @@ jobs:
# Generate docker image tags
# E.g. 'v0.0.0-<variant>' and 'v0.0.0-abc0123-<variant>'
# E.g. 'master-<variant>' and 'master-abc0123-<variant>'
VARIANT="1.0.3"
VARIANT="1.0.4"
REF_VARIANT="${REF}-${VARIANT}"
REF_SHA_VARIANT="${REF}-${SHA}-${VARIANT}"
Expand All @@ -102,45 +102,45 @@ jobs:
echo "REF_VARIANT=$REF_VARIANT" >> $GITHUB_OUTPUT
echo "REF_SHA_VARIANT=$REF_SHA_VARIANT" >> $GITHUB_OUTPUT
- name: 1.0.3 - Build (PRs)
- name: 1.0.4 - Build (PRs)
# Run only on pull requests
if: github.event_name == 'pull_request'
uses: docker/build-push-action@v3
with:
context: variants/1.0.3
context: variants/1.0.4
platforms: linux/386,linux/amd64,linux/arm64
push: false
tags: |
${{ github.repository }}:${{ steps.prep-1-0-3.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-1-0-3.outputs.REF_SHA_VARIANT }}
${{ github.repository }}:${{ steps.prep-1-0-4.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-1-0-4.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: 1.0.3 - Build and push (master)
- name: 1.0.4 - Build and push (master)
# Run only on master
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v3
with:
context: variants/1.0.3
context: variants/1.0.4
platforms: linux/386,linux/amd64,linux/arm64
push: true
tags: |
${{ github.repository }}:${{ steps.prep-1-0-3.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-1-0-3.outputs.REF_SHA_VARIANT }}
${{ github.repository }}:${{ steps.prep-1-0-4.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-1-0-4.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: 1.0.3 - Build and push (release)
- name: 1.0.4 - Build and push (release)
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v3
with:
context: variants/1.0.3
context: variants/1.0.4
platforms: linux/386,linux/amd64,linux/arm64
push: true
tags: |
${{ github.repository }}:${{ steps.prep-1-0-3.outputs.VARIANT }}
${{ github.repository }}:${{ steps.prep-1-0-3.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-1-0-3.outputs.REF_SHA_VARIANT }}
${{ github.repository }}:${{ steps.prep-1-0-4.outputs.VARIANT }}
${{ github.repository }}:${{ steps.prep-1-0-4.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-1-0-4.outputs.REF_SHA_VARIANT }}
${{ github.repository }}:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
Expand All @@ -155,7 +155,7 @@ jobs:
update-draft-release:
needs:
- build-1-0-3
- build-1-0-4
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
Expand All @@ -169,7 +169,7 @@ jobs:

publish-draft-release:
needs:
- build-1-0-3
- build-1-0-4
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
Expand All @@ -185,7 +185,7 @@ jobs:

update-dockerhub-description:
needs:
- build-1-0-3
- build-1-0-4
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ Dockerized [pagefind](https://github.com/CloudCannon/pagefind).

| Tag | Dockerfile Build Context |
|:-------:|:---------:|
| `:1.0.3`, `:latest` | [View](variants/1.0.3) |
| `:1.0.4`, `:latest` | [View](variants/1.0.4) |

## Usage

Mount the public directory into the container at `/public`.

```sh
docker run --rm -it -v $(pwd)/public:/public theohbrothers/docker-pagefind:1.0.3
docker run --rm -it -v $(pwd)/public:/public theohbrothers/docker-pagefind:1.0.4
```

## Development
Expand Down
2 changes: 1 addition & 1 deletion generate/definitions/versions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"pagefind": {
"versions": [
"1.0.3"
"1.0.4"
],
"versionsChangeScope": "minor",
"versionsNewScript": "Invoke-WebRequest https://api.github.com/repos/CloudCannon/pagefind/git/refs/tags | ConvertFrom-Json | % { $_.ref -replace 'refs/tags/v', '' } | ? { $_ -match '^\\d+\\.\\d+\\.\\d+$' } | Sort-Object { [version]$_ } -Descending | ? { [version]$_ -ge [version]'1.0' }"
Expand Down
39 changes: 39 additions & 0 deletions variants/1.0.4/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM alpine:3.17
# Install pagefind_extended
RUN set -eux; \
PAGEFIND_EXTENDED_VERSION=v1.0.4; \
case "$( uname -m )" in \
'x86') \
URL="https://github.com/CloudCannon/pagefind/releases/download/v1.0.4/pagefind_extended-v1.0.4-x86_64-unknown-linux-musl.tar.gz"; \
SHA256=61cdee630d3fbb30763a982ed0c895731d143d6c60a96c37f261aba4837cb930; \
;; \
'x86_64') \
URL="https://github.com/CloudCannon/pagefind/releases/download/v1.0.4/pagefind_extended-v1.0.4-x86_64-unknown-linux-musl.tar.gz"; \
SHA256=61cdee630d3fbb30763a982ed0c895731d143d6c60a96c37f261aba4837cb930; \
;; \
'aarch64') \
URL="https://github.com/CloudCannon/pagefind/releases/download/v1.0.4/pagefind_extended-v1.0.4-aarch64-unknown-linux-musl.tar.gz"; \
SHA256=f450a5bb1f372fbf140fa59bdd0fc424900b7317f67f82538286ccf90e6498de; \
;; \
*) \
echo "Architecture not supported"; \
exit 1; \
;; \
esac; \
FILE=pagefind_extended.tar.gz; \
wget -q "$URL" -O "$FILE"; \
echo "$SHA256 $FILE" | sha256sum -c -; \
tar -xvf "$FILE" --no-same-owner --no-same-permissions -- pagefind_extended; \
rm -f "$FILE"; \
mkdir -pv /usr/local/bin; \
mv -v pagefind_extended /usr/local/bin/pagefind_extended; \
chmod +x /usr/local/bin/pagefind_extended; \
pagefind_extended --version; \
:

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x docker-entrypoint.sh

WORKDIR /
ENTRYPOINT [ "/docker-entrypoint.sh" ]
CMD [ "pagefind_extended", "--site", "/public" ]
8 changes: 8 additions & 0 deletions variants/1.0.4/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- pagefind_extended "$@"
fi

exec "$@"

0 comments on commit 3f805a3

Please sign in to comment.