error-pages/.github/workflows/release.yml

97 lines
3.0 KiB
YAML
Raw Normal View History

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/
- 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>
- name: Docker login in default registry
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_LOGIN }}" --password-stdin
- name: Docker login in ghcr.io # Auth docs: <https://git.io/JLDaw>
run: echo "${{ secrets.GHCR_PASSWORD }}" | docker login ghcr.io -u tarampampam --password-stdin
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 \
--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" \
--tag "ghcr.io/tarampampam/error-pages:${{ steps.values.outputs.version }}" \
--tag "ghcr.io/tarampampam/error-pages:latest" \
--file ./Dockerfile \
--push \
.