2020-07-08 11:12:21 +00:00
|
|
|
name: release
|
|
|
|
|
|
|
|
on:
|
|
|
|
release: # Docs: <https://git.io/JeBz1#release-event-release>
|
|
|
|
types: [published]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
demo:
|
|
|
|
name: Update demonstration, hosted on github pages
|
2021-03-04 06:28:48 +00:00
|
|
|
runs-on: ubuntu-20.04
|
2020-07-08 11:12:21 +00:00
|
|
|
steps:
|
|
|
|
- name: Check out code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Setup NodeJS
|
|
|
|
uses: actions/setup-node@v1 # Action page: <https://github.com/actions/setup-node>
|
|
|
|
with:
|
2021-04-13 13:55:03 +00:00
|
|
|
node-version: 15
|
2020-07-08 11:12:21 +00:00
|
|
|
|
|
|
|
- uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: '**/node_modules'
|
|
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
|
|
|
|
- name: Install dependencies
|
2021-04-13 13:55:03 +00:00
|
|
|
working-directory: generator
|
2020-07-08 17:56:45 +00:00
|
|
|
run: yarn install
|
|
|
|
|
|
|
|
- name: Generate pages
|
2021-04-13 13:55:03 +00:00
|
|
|
run: ./generator/generator.js -i -c ./config.json -o ./out
|
2020-07-08 17:56:45 +00:00
|
|
|
|
2020-07-08 11:12:21 +00:00
|
|
|
- name: Upload artifact
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: content
|
|
|
|
path: out/
|
2021-07-20 10:05:06 +00:00
|
|
|
retention-days: 1
|
2020-07-08 11:12:21 +00:00
|
|
|
|
|
|
|
- name: Switch to github pages branch
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
ref: gh-pages
|
|
|
|
|
|
|
|
- name: Download artifact
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
with:
|
|
|
|
name: content
|
|
|
|
|
|
|
|
- name: Setup git
|
|
|
|
run: |
|
|
|
|
git config --global user.name "$GITHUB_ACTOR"
|
|
|
|
git config --global user.email 'actions@github.com'
|
|
|
|
git remote add github "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git"
|
|
|
|
|
|
|
|
- name: Stage changes
|
|
|
|
run: git add .
|
|
|
|
|
|
|
|
- name: Commit changes
|
2020-07-08 17:46:17 +00:00
|
|
|
run: git commit --allow-empty -m "Deploying ${GITHUB_SHA} to Github Pages"
|
2020-07-08 11:12:21 +00:00
|
|
|
|
|
|
|
- name: Push changes
|
|
|
|
run: git push github --force
|
|
|
|
|
|
|
|
docker-image:
|
|
|
|
name: Build docker image
|
2021-03-04 06:28:48 +00:00
|
|
|
runs-on: ubuntu-20.04
|
2020-07-08 11:12:21 +00:00
|
|
|
steps:
|
|
|
|
- name: Check out code
|
|
|
|
uses: actions/checkout@v2
|
2021-04-13 13:55:03 +00:00
|
|
|
|
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v1 # Action page: <https://github.com/docker/setup-qemu-action>
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1 # Action page: <https://github.com/docker/setup-buildx-action>
|
|
|
|
|
2021-07-20 10:05:06 +00:00
|
|
|
- name: Login to default Container Registry
|
|
|
|
uses: docker/login-action@v1 # Action page: <https://github.com/docker/login-action>
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_LOGIN }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
2021-04-13 13:55:03 +00:00
|
|
|
|
2021-07-20 10:05:06 +00:00
|
|
|
- name: Login to GitHub Container Registry
|
|
|
|
uses: docker/login-action@v1 # Action page: <https://github.com/docker/login-action>
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GHCR_PASSWORD }}
|
2020-07-08 11:12:21 +00:00
|
|
|
|
2021-03-04 06:37:03 +00:00
|
|
|
- name: Generate builder values
|
|
|
|
id: values
|
|
|
|
run: echo "::set-output name=version::${GITHUB_REF##*/[vV]}" # `/refs/tags/v1.2.3` -> `1.2.3`
|
2020-07-08 11:12:21 +00:00
|
|
|
|
|
|
|
- name: Build image
|
2021-04-13 13:55:03 +00:00
|
|
|
run: |
|
|
|
|
docker buildx build \
|
2021-04-13 14:37:12 +00:00
|
|
|
--platform "linux/amd64,linux/arm64/v8,linux/arm/v6,linux/arm/v7" \
|
2021-04-13 13:55:03 +00:00
|
|
|
--tag "tarampampam/error-pages:${{ steps.values.outputs.version }}" \
|
|
|
|
--tag "tarampampam/error-pages:latest" \
|
2021-07-20 10:05:06 +00:00
|
|
|
--tag "ghcr.io/${{ github.actor }}/error-pages:${{ steps.values.outputs.version }}" \
|
|
|
|
--tag "ghcr.io/${{ github.actor }}/error-pages:latest" \
|
2021-04-13 13:55:03 +00:00
|
|
|
--file ./Dockerfile \
|
|
|
|
--push \
|
|
|
|
.
|