Replaces inline docker login + metadata + build-push + tag-cleanup with the shared build-image composite action. Standardizes on CI_BOT_TOKEN (drops REGISTRY_PASSWORD).
This commit is contained in:
@@ -6,50 +6,18 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: fritzlab
|
runs-on: fritzlab
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repo
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Log in to Gitea registry
|
- uses: https://code.fritzlab.net/fritzlab/build-image@v1
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
with:
|
||||||
registry: code.fritzlab.net
|
image: code.fritzlab.net/fritzlab/flock
|
||||||
username: ci-bot
|
token: ${{ secrets.CI_BOT_TOKEN }}
|
||||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
org: fritzlab
|
||||||
|
name: flock
|
||||||
- name: Extract Docker metadata
|
build-args: GIT_SHA=${{ github.sha }}
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: code.fritzlab.net/fritzlab/flock
|
|
||||||
tags: |
|
|
||||||
type=raw,value=latest
|
|
||||||
type=raw,value=${{ github.run_number }}
|
|
||||||
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
provenance: false
|
|
||||||
build-args: |
|
|
||||||
GIT_SHA=${{ github.sha }}
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
network: host
|
|
||||||
|
|
||||||
- name: Smoke-test image
|
- name: Smoke-test image
|
||||||
run: |
|
run: |
|
||||||
docker run --rm code.fritzlab.net/fritzlab/flock:${{ github.run_number }} --help || true
|
docker run --rm code.fritzlab.net/fritzlab/flock:${{ github.run_number }} --help || true
|
||||||
docker run --rm --entrypoint /usr/local/bin/flock \
|
docker run --rm --entrypoint /usr/local/bin/flock \
|
||||||
code.fritzlab.net/fritzlab/flock:${{ github.run_number }} || true
|
code.fritzlab.net/fritzlab/flock:${{ github.run_number }} || true
|
||||||
|
|
||||||
- name: Clean up old image tags
|
|
||||||
run: |
|
|
||||||
tea login add --name ci --url https://code.fritzlab.net --token '${{ secrets.CI_BOT_TOKEN }}' --no-version-check
|
|
||||||
tea api '/packages/fritzlab?type=container' \
|
|
||||||
| jq -r '.[] | select(.name=="flock") | select(.version | test("^[0-9]+$")) | .version' \
|
|
||||||
| sort -n | head -n -3 \
|
|
||||||
| while read tag; do
|
|
||||||
echo "deleting flock:$tag"
|
|
||||||
tea api -X DELETE "/packages/fritzlab/container/flock/$tag"
|
|
||||||
done
|
|
||||||
|
|||||||
Reference in New Issue
Block a user