mirror of
https://github.com/rommapp/romm.git
synced 2026-12-05 05:07:31 +01:00
Rework GitHub Actions Workflow
This commit is contained in:
9
.github/actions/build.sh
vendored
9
.github/actions/build.sh
vendored
@@ -1,9 +0,0 @@
|
||||
if [[ $GIT_BRANCH != 'master' ]]; then
|
||||
docker buildx build --push\
|
||||
--tag zurdi15/romm:dev-latest --tag zurdi15/romm:dev-${VERSION}\
|
||||
--platform linux/arm64 . --file ./docker/Dockerfile
|
||||
else
|
||||
docker buildx build --push\
|
||||
--tag zurdi15/romm:latest --tag zurdi15/romm:${VERSION}\
|
||||
--platform linux/arm64,linux/amd64 . --file ./docker/Dockerfile
|
||||
fi
|
||||
56
.github/workflows/image.yml
vendored
56
.github/workflows/image.yml
vendored
@@ -11,20 +11,52 @@ on:
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: write
|
||||
packages: write
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
- name: Set environment variables
|
||||
run: echo "GIT_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
|
||||
- name: Install buildx
|
||||
id: buildx
|
||||
uses: crazy-max/ghaction-docker-buildx@v1
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
version: latest
|
||||
- name: Login to docker hub
|
||||
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
|
||||
- name: Build the image
|
||||
shell: bash
|
||||
run: ./.github/actions/build.sh
|
||||
env:
|
||||
VERSION: ${{ inputs.version }}
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Generate Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
name=zurdi15/romm
|
||||
name=ghcr.io/zurdi15/romm
|
||||
flavor: |
|
||||
# latest on master branch, prefix dev on other branches
|
||||
latest=${{ github.ref == format('refs/heads/{0}', 'master') }}
|
||||
prefix=${{ github.ref != format('refs/heads/{0}', 'master') && 'dev-' || '' }}
|
||||
tags: |
|
||||
type=raw,value=latest
|
||||
type=raw,value=${{ inputs.version }}
|
||||
labels: |
|
||||
org.opencontainers.image.version=${{ inputs.version }}
|
||||
- name: Build image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
file: docker/Dockerfile
|
||||
context: .
|
||||
push: true
|
||||
platforms: linux/arm64,linux/amd64
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
Reference in New Issue
Block a user