Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
58a1a8ee2f
|
|||
bbeebda027
|
|||
267ec22c6f
|
|||
a95bf7a43e
|
|||
20de0927da
|
@@ -11,50 +11,31 @@ permissions:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build image
|
||||
runs-on: dind
|
||||
env:
|
||||
REGISTRY: hub.realmanual.ru
|
||||
IMAGE_NAME: pub/sqlite-backup/backup
|
||||
container: git.realmanual.ru/pub/docker-build
|
||||
steps:
|
||||
- name: Checkout (git)
|
||||
shell: bash
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
: "${GITHUB_SERVER_URL:?}"
|
||||
: "${GITHUB_REPOSITORY:?}"
|
||||
: "${GITHUB_SHA:?}"
|
||||
git init .
|
||||
git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
|
||||
git -c http.extraHeader="Authorization: Bearer ${TOKEN}" fetch --no-tags --depth=1 origin "${GITHUB_SHA}"
|
||||
git checkout --detach "${GITHUB_SHA}"
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Extract tag
|
||||
id: vars
|
||||
shell: bash
|
||||
run: |
|
||||
TAG_REF="${GITHUB_REF#refs/tags/}"
|
||||
echo "tag=$TAG_REF" >> "$GITHUB_OUTPUT"
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: hub.realmanual.ru
|
||||
username: ${{ gitea.actor }}
|
||||
password: ${{ secrets.PUSH_TOKEN }}
|
||||
|
||||
- name: Docker login
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
echo "${{ secrets.GITEA_TOKEN }}" | docker login "${{ env.REGISTRY }}" --username "${{ github.actor }}" --password-stdin
|
||||
- name: Extract metadata (tags, labels) for
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ gitea.repository }}
|
||||
|
||||
- name: Build image
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
docker build \
|
||||
-t "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.tag }}" \
|
||||
-t "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" \
|
||||
.
|
||||
|
||||
- name: Push images
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
docker push "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.tag }}"
|
||||
docker push "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
|
||||
- name: Build and push Docker image
|
||||
id: push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
Reference in New Issue
Block a user