2020-07-08 11:12:21 +00:00
|
|
|
name: release
|
|
|
|
|
|
|
|
on:
|
|
|
|
release: # Docs: <https://git.io/JeBz1#release-event-release>
|
|
|
|
types: [published]
|
|
|
|
|
|
|
|
jobs:
|
2022-03-28 17:13:19 +00:00
|
|
|
purge-cdn-cache:
|
|
|
|
name: Purge jsDelivr CDN cache
|
2023-02-23 17:50:20 +00:00
|
|
|
runs-on: ubuntu-latest
|
2022-03-28 17:13:19 +00:00
|
|
|
steps:
|
2022-03-30 16:23:42 +00:00
|
|
|
- uses: gacts/purge-jsdelivr-cache@v1 # Action page: <https://github.com/gacts/purge-jsdelivr-cache>
|
|
|
|
with:
|
|
|
|
url: |
|
|
|
|
https://cdn.jsdelivr.net/gh/tarampampam/error-pages@2/l10n/l10n.js
|
|
|
|
https://cdn.jsdelivr.net/gh/tarampampam/error-pages@2/l10n/l10n.min.js
|
|
|
|
https://cdn.jsdelivr.net/gh/tarampampam/error-pages@latest/l10n/l10n.js
|
|
|
|
https://cdn.jsdelivr.net/gh/tarampampam/error-pages@latest/l10n/l10n.min.js
|
2022-03-28 17:13:19 +00:00
|
|
|
|
2021-09-29 15:38:50 +00:00
|
|
|
build:
|
|
|
|
name: Build for ${{ matrix.os }} (${{ matrix.arch }})
|
2023-02-23 17:50:20 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-09-29 15:38:50 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
os: [linux, darwin] # linux, freebsd, darwin, windows
|
|
|
|
arch: [amd64] # amd64, 386
|
2020-07-08 11:12:21 +00:00
|
|
|
steps:
|
2023-10-09 12:46:36 +00:00
|
|
|
- uses: actions/checkout@v4
|
2020-07-08 11:12:21 +00:00
|
|
|
|
2023-02-02 09:09:29 +00:00
|
|
|
- uses: gacts/setup-go-with-cache@v1
|
|
|
|
with: {go-version-file: go.mod}
|
|
|
|
|
|
|
|
- {uses: gacts/github-slug@v1, id: slug}
|
2020-07-08 11:12:21 +00:00
|
|
|
|
2021-09-29 15:38:50 +00:00
|
|
|
- name: Generate builder values
|
|
|
|
id: values
|
2023-02-23 18:03:32 +00:00
|
|
|
run: echo "binary-name=error-pages-${{ matrix.os }}-${{ matrix.arch }}" >> $GITHUB_OUTPUT
|
2021-09-29 15:38:50 +00:00
|
|
|
|
|
|
|
- name: Build application
|
|
|
|
env:
|
|
|
|
GOOS: ${{ matrix.os }}
|
|
|
|
GOARCH: ${{ matrix.arch }}
|
|
|
|
CGO_ENABLED: 0
|
2023-02-23 17:50:20 +00:00
|
|
|
LDFLAGS: -s -w -X gh.tarampamp.am/error-pages/internal/version.version=${{ steps.slug.outputs.version }}
|
2021-09-29 15:38:50 +00:00
|
|
|
run: go build -trimpath -ldflags "$LDFLAGS" -o "./${{ steps.values.outputs.binary-name }}" ./cmd/error-pages/
|
|
|
|
|
|
|
|
- name: Upload binary file to release
|
|
|
|
uses: svenstaro/upload-release-action@v2
|
2020-07-08 11:12:21 +00:00
|
|
|
with:
|
2021-09-29 15:38:50 +00:00
|
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
file: ${{ steps.values.outputs.binary-name }}
|
|
|
|
asset_name: ${{ steps.values.outputs.binary-name }}
|
|
|
|
tag: ${{ github.ref }}
|
2020-07-08 11:12:21 +00:00
|
|
|
|
|
|
|
docker-image:
|
|
|
|
name: Build docker image
|
2023-02-23 17:50:20 +00:00
|
|
|
runs-on: ubuntu-latest
|
2020-07-08 11:12:21 +00:00
|
|
|
steps:
|
2023-10-09 12:46:36 +00:00
|
|
|
- uses: actions/checkout@v4
|
2021-09-29 15:38:50 +00:00
|
|
|
|
2023-02-02 09:09:29 +00:00
|
|
|
- {uses: gacts/github-slug@v1, id: slug}
|
2021-04-13 13:55:03 +00:00
|
|
|
|
2023-10-09 12:42:41 +00:00
|
|
|
- uses: docker/setup-qemu-action@v3 # Action page: <https://github.com/docker/setup-qemu-action>
|
2021-04-13 13:55:03 +00:00
|
|
|
|
2023-10-02 06:48:39 +00:00
|
|
|
- uses: docker/setup-buildx-action@v3 # Action page: <https://github.com/docker/setup-buildx-action>
|
2021-04-13 13:55:03 +00:00
|
|
|
|
2023-10-02 06:53:40 +00:00
|
|
|
- uses: docker/login-action@v3 # Action page: <https://github.com/docker/login-action>
|
2021-07-20 10:05:06 +00:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_LOGIN }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
2021-04-13 13:55:03 +00:00
|
|
|
|
2023-10-02 06:53:40 +00:00
|
|
|
- uses: docker/login-action@v3 # Action page: <https://github.com/docker/login-action>
|
2021-07-20 10:05:06 +00:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
2022-05-12 12:20:02 +00:00
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
2020-07-08 11:12:21 +00:00
|
|
|
|
2023-10-09 12:46:25 +00:00
|
|
|
- uses: docker/build-push-action@v5 # Action page: <https://github.com/docker/build-push-action>
|
2021-09-29 15:38:50 +00:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: Dockerfile
|
|
|
|
push: true
|
2024-03-17 07:39:51 +00:00
|
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm64/v8
|
2021-09-29 15:38:50 +00:00
|
|
|
build-args: "APP_VERSION=${{ steps.slug.outputs.version }}"
|
|
|
|
tags: |
|
|
|
|
tarampampam/error-pages:${{ steps.slug.outputs.version }}
|
2022-04-01 08:14:16 +00:00
|
|
|
tarampampam/error-pages:${{ steps.slug.outputs.version-major }}.${{ steps.slug.outputs.version-minor }}
|
|
|
|
tarampampam/error-pages:${{ steps.slug.outputs.version-major }}
|
2021-09-29 15:38:50 +00:00
|
|
|
tarampampam/error-pages:latest
|
|
|
|
ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}:${{ steps.slug.outputs.version }}
|
2022-04-01 08:14:16 +00:00
|
|
|
ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}:${{ steps.slug.outputs.version-major }}.${{ steps.slug.outputs.version-minor }}
|
|
|
|
ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}:${{ steps.slug.outputs.version-major }}
|
2021-09-29 15:38:50 +00:00
|
|
|
ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}:latest
|
2020-07-08 11:12:21 +00:00
|
|
|
|
2021-09-29 15:38:50 +00:00
|
|
|
demo:
|
|
|
|
name: Update the demonstration
|
2023-02-23 17:50:20 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-09-29 15:38:50 +00:00
|
|
|
needs: [docker-image]
|
|
|
|
steps:
|
2023-02-02 09:09:29 +00:00
|
|
|
- {uses: gacts/github-slug@v1, id: slug}
|
2021-09-29 15:38:50 +00:00
|
|
|
|
|
|
|
- name: Take rendered templates from the built docker image
|
2021-04-13 13:55:03 +00:00
|
|
|
run: |
|
2021-09-29 15:38:50 +00:00
|
|
|
docker create --name img ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}:${{ steps.slug.outputs.version }}
|
|
|
|
docker cp img:/opt/html ./out
|
|
|
|
docker rm -f img
|
|
|
|
|
|
|
|
- name: Deploy to GitHub Pages
|
2024-04-27 10:54:51 +00:00
|
|
|
uses: peaceiris/actions-gh-pages@v4
|
2021-09-29 15:38:50 +00:00
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
publish_dir: ./out
|