chore: fix ci

This commit is contained in:
uetchy 2021-10-27 15:53:06 +09:00
parent d807a0407f
commit 6176227dfa
4 changed files with 62 additions and 86 deletions

45
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,45 @@
# https://hexo.io/docs/github-pages.html
# https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#github-cache
name: ci
on:
push:
branches:
- master
jobs:
buildAndPush:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ghcr.io/uetchy/uechi.io:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
- name: Trigger Watchtower Update
run: |
curl -s -H "Authorization: Bearer ${{ secrets.WATCHTOWER_TOKEN }}" https://watchtower.uechi.dev/v1/update

View File

@ -1,75 +0,0 @@
# https://hexo.io/docs/github-pages.html
name: Docker
on:
push:
branches:
- master
jobs:
buildAndPush:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: ghcr.io/uetchy/uechi.io:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- name: Cache deps stage
uses: docker/build-push-action@v2
with:
target: deps
tags: deps_stage
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- name: Cache build stage
uses: docker/build-push-action@v2
with:
target: build
tags: build_stage
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
- name: Trigger Watchtower Update
run: |
curl -s -H "Authorization: Bearer ${{ secrets.WATCHTOWER_TOKEN }}" https://watchtower.uechi.dev/v1/update
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

View File

@ -1,14 +1,12 @@
FROM node:15 as deps
FROM node:15 as build
# https://github.com/jgm/pandoc/releases
RUN curl -LO https://github.com/jgm/pandoc/releases/download/2.14.0.1/pandoc-2.14.0.1-1-amd64.deb
RUN dpkg -i pandoc-2.14.0.1-1-amd64.deb
WORKDIR /app
COPY package.json /app
RUN yarn install
FROM deps as build
COPY package.json yarn.lock /app/
RUN yarn install --frozen-lockfile
COPY themes /app/themes
COPY source /app/source
@ -18,4 +16,4 @@ RUN yarn build
FROM nginx:stable-alpine as runtime
COPY nginx.conf /etc/nginx/nginx.conf
COPY --from=build /app/public /var/www/html/
COPY --from=build /app/public /var/www/html/

View File

@ -252,6 +252,14 @@ on the host machine:
ssh-copy-id <user>@<ip>
```
```bash:$HOME/.ssh/rc
if [ ! -S ~/.ssh/ssh_auth_sock ] && [ -S "$SSH_AUTH_SOCK" ]; then
ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock
fi
```
See also: [Happy ssh agent forwarding for tmux/screen · Reboot and Shine](https://werat.dev/blog/happy-ssh-agent-forwarding/)
## AUR
```bash
@ -568,19 +576,19 @@ restic backup --tag system -v \
--exclude /var/lib/docker/overlay2 \
/ /boot
# ftl
restic backup --tag ftl -v \
/mnt/ftl
# data
restic backup --tag data -v \
--exclude 'appdata_*/preview' \
--exclude 'appdata_*/dav-photocache' \
/mnt/data
# prune
restic forget --prune --group-by tags \
--keep-daily 7 --keep-weekly 3 --keep-monthly 3
--keep-within-daily 7d \
--keep-within-weekly 1m \
--keep-within-monthly 3m
# verify
restic check
```