Skip to content

Rewrite workflow

Rewrite workflow #17

Workflow file for this run

name: Docker Image CI
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
REGISTRY_IMAGE: ghcr.io/${{ github.repository }}
on:
push:
release:
types:
- created
#jobs:
# build-release:
# if: "!github.event.release.prerelease"
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# platform:
# - linux/amd64
# - linux/arm64
#
# # See https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners
# steps:
# - uses: actions/checkout@v4
#
# - name: Log in to registry
# run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
#
# - name: Get Previous tag
# id: previoustag
# uses: "WyriHaximus/github-action-get-previous-tag@v1"
# with:
# fallback: v0.1
#
# - name: Set up Docker Buildx
# id: buildx
# uses: docker/setup-buildx-action@v3
#
# - name: Build and push
# id: docker_build
# uses: docker/build-push-action@v6
# with:
# push: true
# context: .
# target: target
# file: ./Dockerfile
# cache-from: type=gha
# cache-to: type=gha,mode=max
# platforms: ${{ matrix.platform }}
# build-args: VITE_BUILD_ID="Github Actions"
# tags:
# ${{ env.REGISTRY_IMAGE }}:latest, ${{ env.REGISTRY_IMAGE }}:${{ steps.previoustag.outputs.tag }}
jobs:
build-node:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push by digest
id: build
uses: docker/build-push-action@v6
with:
context: .
push: false
target: builder
file: ./Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: VITE_BUILD_ID="Github Actions"
platforms: linux/amd64
- name: Create container from image
run: docker create --name extract-container ${{ env.REGISTRY_IMAGE }}:latest
- name: Copy files from container
run: docker cp extract-container:/app/packages/yii-dev-panel/dist /tmp/dist
- name: List extracted files
run: ls -la /tmp/dist
- name: Clean up
run: docker rm extract-container
- name: Share JS build
uses: actions/upload-artifact@v4
with:
name: js-build
path: /tmp/dist
if-no-files-found: error
retention-days: 1
build:
runs-on: ubuntu-latest
needs: [build-node]
steps:
- uses: actions/checkout@v4
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}
- name: Download builder image
uses: actions/download-artifact@v4
with:
name: js-build
path: /tmp
- name: Get Previous tag
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
with:
fallback: v0.1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
id: docker_build
uses: docker/build-push-action@v6
with:
push: true
context: .
file: ./Github.Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
labels: ${{ steps.meta.outputs.labels }}
tags:
${{ env.REGISTRY_IMAGE }}:latest, ${{ env.REGISTRY_IMAGE }}:${{ steps.previoustag.outputs.tag }}