mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-06-27 01:02:41 +02:00
101 lines
2.8 KiB
YAML
101 lines
2.8 KiB
YAML
name: Build snapshot of PR
|
|
|
|
on: pull_request
|
|
|
|
env:
|
|
REGISTRY_IMAGE: ghcr.io/museofficial/muse
|
|
|
|
jobs:
|
|
build:
|
|
name: Build snapshot
|
|
strategy:
|
|
matrix:
|
|
runner-platform:
|
|
- ubuntu-latest
|
|
- namespace-profile-default-arm64
|
|
include:
|
|
- runner-platform: ubuntu-latest
|
|
build-arch: linux/amd64
|
|
- runner-platform: namespace-profile-default-arm64
|
|
build-arch: linux/arm64
|
|
runs-on: ${{ matrix.runner-platform }}
|
|
steps:
|
|
- name: Prepare
|
|
run: |
|
|
platform=${{ matrix.build-arch }}
|
|
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
|
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY_IMAGE }}
|
|
tags: type=ref,event=pr
|
|
|
|
- name: Set up Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Get current time
|
|
uses: josStorer/get-current-time@v2
|
|
id: current-time
|
|
|
|
- name: Build
|
|
id: build
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
outputs: type=docker,dest=/tmp/image-${{ env.PLATFORM_PAIR }}.tar
|
|
platforms: ${{ matrix.build-arch }}
|
|
tags: |
|
|
${{ env.REGISTRY_IMAGE }}:${{ github.sha }}-${{ env.PLATFORM_PAIR }}
|
|
build-args: |
|
|
COMMIT_HASH=${{ github.sha }}
|
|
BUILD_DATE=${{ steps.current-time.outputs.time }}
|
|
|
|
- name: Export Docker meta output
|
|
shell: bash
|
|
run: echo $DOCKER_METADATA_OUTPUT_JSON > /tmp/metadata.json
|
|
|
|
- name: Upload metadata
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: metadata
|
|
path: /tmp/metadata.json
|
|
overwrite: true
|
|
|
|
- name: Export SHA
|
|
run: |
|
|
echo "${{ github.sha }}" > /tmp/sha.txt
|
|
|
|
- name: Upload SHA
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: sha
|
|
path: /tmp/sha.txt
|
|
overwrite: true
|
|
|
|
- name: Upload image
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: image-${{ env.PLATFORM_PAIR }}
|
|
path: /tmp/image-${{ env.PLATFORM_PAIR }}.tar
|
|
if-no-files-found: error
|
|
retention-days: 1
|
|
|
|
- name: Save PR number in artifact
|
|
shell: bash
|
|
env:
|
|
PR_NUMBER: ${{ github.event.number }}
|
|
run: echo $PR_NUMBER > /tmp/pull_request_number.txt
|
|
- name: Upload PR number
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: pull_request_number
|
|
path: /tmp/pull_request_number.txt
|
|
overwrite: true
|