devops: trigger build-and-push on release publish; extract release tag; pass it to build-and-push.sh; add docker to the dockerfile for cli availability.
This commit is contained in:
parent
7f02ea62b3
commit
fd3bb28fab
@ -1,13 +1,8 @@
|
|||||||
name: build-and-upload-docker
|
name: build-and-upload-docker
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
release:
|
||||||
branches:
|
types: [published]
|
||||||
- trunk
|
|
||||||
paths:
|
|
||||||
- 'Dockerfile'
|
|
||||||
- 'rootfs/**'
|
|
||||||
- 'build.sh'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-upload:
|
build-and-upload:
|
||||||
@ -15,17 +10,27 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Parse release version
|
||||||
|
id: get_version
|
||||||
|
run: |
|
||||||
|
# Remove 'refs/tags/' if present, fallback to GITHUB_REF_NAME if possible
|
||||||
|
ref="${GITHUB_REF#refs/tags/}"
|
||||||
|
if [ -z "$ref" ]; then
|
||||||
|
ref="${GITHUB_REF_NAME:-}"
|
||||||
|
fi
|
||||||
|
echo "release_tag=$ref" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
run: |
|
run: |
|
||||||
chmod +x ./build.sh
|
chmod +x ./build-and-push.sh
|
||||||
./build.sh
|
./build-and-push.sh "${{ steps.get_version.outputs.release_tag }}"
|
||||||
@ -1,2 +1,2 @@
|
|||||||
FROM gitea/act_runner:latest
|
FROM gitea/act_runner:latest
|
||||||
RUN apk add --no-cache nodejs npm
|
RUN apk add --no-cache nodejs npm docker
|
||||||
Loading…
x
Reference in New Issue
Block a user