mirror of
https://github.com/aykhans/slash-e.git
synced 2025-04-18 21:19:44 +00:00
chore: update build action
This commit is contained in:
parent
0857e4ea68
commit
bd8462b2b3
@ -1,14 +1,18 @@
|
|||||||
name: build-and-push-release-image
|
name: build-and-push-stable-image
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
tags:
|
||||||
# Run on pushing branches like `release/1.0.0`
|
# Match stable and rc versions, such as 'v1.0.0' or 'v0.23.0-rc.0'
|
||||||
- "release/*.*.*"
|
- "v*.*.*"
|
||||||
|
- "v*.*.*-rc.*"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push-release-image:
|
build-and-push-stable-image:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@ -16,10 +20,14 @@ jobs:
|
|||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
- name: Extract build args
|
- name: Extract build args
|
||||||
# Extract version from branch name
|
# Extract version number and check if it's an rc version
|
||||||
# Example: branch name `release/1.0.0` sets up env.VERSION=1.0.0
|
|
||||||
run: |
|
run: |
|
||||||
echo "VERSION=${GITHUB_REF_NAME#release/}" >> $GITHUB_ENV
|
if [[ "${GITHUB_REF_NAME}" =~ -rc ]]; then
|
||||||
|
echo "PRE_RELEASE=true" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "PRE_RELEASE=false" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
@ -32,6 +40,36 @@ jobs:
|
|||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
with:
|
with:
|
||||||
install: true
|
install: true
|
||||||
|
version: v0.9.1
|
||||||
|
|
||||||
|
# Metadata for stable versions
|
||||||
|
- name: Docker meta for stable
|
||||||
|
id: meta-stable
|
||||||
|
if: env.PRE_RELEASE == 'false'
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
yourselfhosted/slash
|
||||||
|
tags: |
|
||||||
|
type=semver,pattern={{version}},value=${{ env.VERSION }}
|
||||||
|
type=raw,value=stable
|
||||||
|
flavor: |
|
||||||
|
latest=true
|
||||||
|
labels: |
|
||||||
|
org.opencontainers.image.version=${{ env.VERSION }}
|
||||||
|
|
||||||
|
# Metadata for rc versions
|
||||||
|
- name: Docker meta for rc
|
||||||
|
id: meta-rc
|
||||||
|
if: env.PRE_RELEASE == 'true'
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
yourselfhosted/slash
|
||||||
|
tags: |
|
||||||
|
type=raw,value=${{ env.VERSION }}
|
||||||
|
labels: |
|
||||||
|
org.opencontainers.image.version=${{ env.VERSION }}
|
||||||
|
|
||||||
- name: Build and Push
|
- name: Build and Push
|
||||||
id: docker_build
|
id: docker_build
|
||||||
@ -41,4 +79,5 @@ jobs:
|
|||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: yourselfhosted/slash:latest, yourselfhosted/slash:${{ env.VERSION }}
|
tags: ${{ steps.meta-stable.outputs.tags || steps.meta-rc.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta-stable.outputs.labels || steps.meta-rc.outputs.labels }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user