feat: update api.yml #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build api | |
on: | |
push: | |
branches: | |
- "main" | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build: | |
name: Build binary and push (api) | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
platform: [linux/amd64, linux/arm64] | |
permissions: | |
contents: read | |
packages: write | |
attestations: write | |
id-token: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup environment | |
run: echo "ARCH=$(uname -m)" >> $GITHUB_ENV | |
- name: Build binary | |
run: cargo build --release | |
- name: Copy binary | |
run: mv target/release/api api/api | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to repository | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ env.ARCH }} | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
platforms: linux/arm64 | |
context: api | |
file: api/Dockerfile | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
# combine: | |
# name: Combine docker manifests | |
# runs-on: ubuntu-22.04 | |
# steps: |