From 6176227dfad27ae69cf5f031447d872ab63ef67b Mon Sep 17 00:00:00 2001 From: Yasuaki Uechi Date: Wed, 27 Oct 2021 15:53:06 +0900 Subject: [PATCH] chore: fix ci --- .github/workflows/ci.yml | 45 +++++++++++++ .github/workflows/docker.yml | 75 --------------------- Dockerfile | 10 ++- source/_posts/2021/installing-arch-linux.md | 18 +++-- 4 files changed, 62 insertions(+), 86 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..cc340fa --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index 4ab19dd..0000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -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 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 8465399..fc0e1a7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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/ \ No newline at end of file +COPY --from=build /app/public /var/www/html/ diff --git a/source/_posts/2021/installing-arch-linux.md b/source/_posts/2021/installing-arch-linux.md index 2673528..0fa511e 100644 --- a/source/_posts/2021/installing-arch-linux.md +++ b/source/_posts/2021/installing-arch-linux.md @@ -252,6 +252,14 @@ on the host machine: ssh-copy-id @ ``` +```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 ```