Skip to content

Update LATEST_VERSION to 3283.v92c105e0f819-1 #1

Update LATEST_VERSION to 3283.v92c105e0f819-1

Update LATEST_VERSION to 3283.v92c105e0f819-1 #1

name: Build Docker Image
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
paths:
- 'LATEST_VERSION'
workflow_dispatch:
env:
# github.repository as <account>/<repo>
IMAGE_NAME: LamGC/poweradmin-docker
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
# 从仓库目录下读取 LATEST_VERSION 文件,获取最新版本号
- name: Read latest version
id: read-version
run: echo ::set-output name=version::$(cat LATEST_VERSION)
# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 # v3.0.0
- name: Download latest PowerAdmin
run: ./download-latest-poweradmin.sh
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Login docker hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3 # v3.0.0
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: .
push: true
tags: ${{ env.IMAGE_NAME }}:latest, ${{ env.IMAGE_NAME }}:${{ steps.read-version.outputs.version }}
cache-from: type=gha
cache-to: type=gha,mode=max