From dd92eef7dd3a95c4dcd26de87a0e5ee85c464414 Mon Sep 17 00:00:00 2001 From: lennoxlotl Date: Mon, 21 Oct 2024 16:36:18 +0200 Subject: [PATCH] feat: update api.yml --- .github/workflows/api.yml | 65 ++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/.github/workflows/api.yml b/.github/workflows/api.yml index 1563971..f7c3fd8 100644 --- a/.github/workflows/api.yml +++ b/.github/workflows/api.yml @@ -12,6 +12,11 @@ jobs: 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 @@ -19,31 +24,35 @@ jobs: run: | echo "SHORT_COMMIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV echo "BRANCH_NAME=$(git branch --show-current)" >> $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 }} - - name: Build and push - uses: docker/build-push-action@v3 - with: - push: true - platforms: linux/arm64 - context: apps/api - file: apps/api/Dockerfile - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + - name: Test + run: echo "$MATRIX_TEST" + env: + MATRIX_TEST: ${{ matrix.platform }} + # - 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 }} + # - name: Build and push + # uses: docker/build-push-action@v3 + # with: + # push: true + # platforms: linux/arm64 + # context: apps/api + # file: apps/api/Dockerfile + # tags: ${{ steps.meta.outputs.tags }} + # labels: ${{ steps.meta.outputs.labels }}