fix PR build pipeline
This commit is contained in:
1 parent
c1906a3f20
commit
7a62a75aa6
1 file changed
+8
-13
@@ -1,3 +1,4 @@
|
|||||||
|
---
|
||||||
name: Build PR
|
name: Build PR
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@@ -24,48 +25,42 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
- name: Extract PR information
|
- name: Set variables
|
||||||
id: extract_pr
|
|
||||||
run: |
|
run: |
|
||||||
echo "PR_NUMBER=$${{ github.event.pull_request.number || github.run_number }}" >> $GITHUB_ENV
|
echo "PR_NUMBER=$${{ github.event.pull_request.number || github.run_number }}" >> $GITHUB_ENV
|
||||||
echo "REGISTRY_LOWER=$(echo '${{ env.REGISTRY }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
|
echo "REGISTRY_LOWER=$(echo '${{ env.REGISTRY }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
|
||||||
echo "REPOSITORY_LOWER=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
|
echo "REPOSITORY_LOWER=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Log in to the Container registry
|
- name: Log in to the Container registry
|
||||||
uses: docker/login-action@v3.1.0
|
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.REGISTRY }}
|
registry: ${{ env.REGISTRY }}
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ github.token }}
|
password: ${{ github.token }}
|
||||||
|
|
||||||
# Build Docker Images (amd64 and arm64)
|
# Build Docker Images (amd64 and arm64)
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Create version files
|
- name: Create version files
|
||||||
run: |
|
run: |
|
||||||
echo "pr-${{ env.PR_NUMBER }}" > version.txt
|
echo "${{ env.PR_NUMBER }}" > version.txt
|
||||||
echo "${{ github.sha }}" > version_githash.txt
|
echo "${{ github.sha }}" > version_githash.txt
|
||||||
ls -ltr
|
ls -ltr
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
id: push
|
id: push
|
||||||
uses: docker/build-push-action@v5.3.0
|
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64,linux/aarch64
|
platforms: linux/amd64,linux/aarch64
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: "${{ env.REGISTRY_LOWER }}/${{ env.REPOSITORY_LOWER }}-pr:${{ env.PR_NUMBER }}"
|
||||||
${{ env.REGISTRY_LOWER }}/linux-voice-assistant-pr:${{ env.PR_NUMBER }}
|
labels: "${{ env.PR_NUMBER }}"
|
||||||
labels: |
|
|
||||||
pr=${{ env.PR_NUMBER }}
|
|
||||||
|
|
||||||
- name: Generate artifact attestation
|
- name: Generate artifact attestation
|
||||||
uses: actions/attest-build-provenance@v1.4.4
|
uses: actions/attest-build-provenance@v1.4.4
|
||||||
with:
|
with:
|
||||||
subject-name: ${{ env.REGISTRY }}/linux-voice-assistant-pr
|
subject-name: ${{ env.REGISTRY_LOWER }}/${{ env.REPOSITORY_LOWER }}-pr
|
||||||
subject-digest: ${{ steps.push.outputs.digest }}
|
subject-digest: ${{ steps.push.outputs.digest }}
|
||||||
push-to-registry: true
|
push-to-registry: true
|
||||||
Reference in new issue
Block a user