Skip to content

Rewrite workflow

Rewrite workflow #21

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-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: .
load: true
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
tags: ${{ env.REGISTRY_IMAGE }}:latest
- 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 JS build
uses: actions/download-artifact@v4
with:
name: js-build
path: dist
- name: List extracted files
run: ls -la dist
- 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
uses: docker/build-push-action@v6
with:
context: .
push: true
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 }}