perf: setup github actions

This commit is contained in:
Clansty 2023-01-15 10:17:46 +08:00
parent 6db646f933
commit df39db1f00
1 changed files with 8 additions and 34 deletions

View File

@ -10,41 +10,15 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: OCI meta - name: Cache install Nix packages
id: meta uses: mtoohey31/cache-flake-attrs@v2
uses: docker/metadata-action@v3
with: with:
images: ghcr.io/${{ github.repository }} key: ${{ runner.os }}-nix-${{ hashFiles('./flake.lock', './flake.nix', './yarn.lock') }}
tags: | flake_paths: .#packages.x86_64-linux.default
type=edge,branch=main
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push - name: Build and push
uses: docker/build-push-action@v3 run: |
with: nix --extra-experimental-features nix-command --extra-experimental-features flakes run .#docker.copyTo -vL -- --dest-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} docker://ghcr.io/${GITHUB_REPOSITORY,,}:${{ github.sha }}
context: . nix --extra-experimental-features nix-command --extra-experimental-features flakes run .#docker.copyTo -vL -- --dest-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} docker://ghcr.io/${GITHUB_REPOSITORY,,}:${{ github.ref_name }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max