Use modern build actions
This commit is contained in:
parent
899fe654e2
commit
e0e245dfc0
|
@ -14,22 +14,12 @@ jobs:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Prepare
|
- name: Docker meta
|
||||||
id: prepare
|
id: meta
|
||||||
run: |
|
uses: docker/metadata-action@v4
|
||||||
DOCKER_IMAGE=ghcr.io/${{ github.repository_owner }}/linx-server
|
with:
|
||||||
DOCKER_PLATFORMS=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/386
|
images: ghcr.io/${{ github.repository_owner }}/linx-server
|
||||||
VERSION=${GITHUB_REF#refs/tags/v}
|
|
||||||
TAGS="--tag ${DOCKER_IMAGE}:${VERSION} --tag ${DOCKER_IMAGE}:latest --tag ${DOCKER_IMAGE}:${GITHUB_SHA::8}"
|
|
||||||
|
|
||||||
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
|
||||||
echo ::set-output name=version::${VERSION}
|
|
||||||
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
|
|
||||||
--build-arg VERSION=${VERSION} \
|
|
||||||
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
|
|
||||||
--build-arg VCS_REF=${GITHUB_SHA::8} \
|
|
||||||
${TAGS} --file Dockerfile .
|
|
||||||
|
|
||||||
- name: Login to GHCR
|
- name: Login to GHCR
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
|
@ -38,12 +28,10 @@ jobs:
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Build and push
|
||||||
uses: crazy-max/ghaction-docker-buildx@v3
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
- name: Docker Buildx (build)
|
context: .
|
||||||
run: docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
- name: Docker Buildx (push)
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
if: success()
|
|
||||||
run: docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }}
|
|
Loading…
Reference in New Issue