1 Commits
1.0.2 ... 1.0.3

View File

@@ -16,10 +16,19 @@ jobs:
REGISTRY: hub.realmanual.ru
IMAGE_NAME: pub/sqlite-backup/backup
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- 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: Extract tag
id: vars
@@ -28,22 +37,24 @@ jobs:
TAG_REF="${GITHUB_REF#refs/tags/}"
echo "tag=$TAG_REF" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker login
shell: bash
run: |
set -euo pipefail
echo "${{ secrets.GITEA_TOKEN }}" | docker login "${{ env.REGISTRY }}" --username "${{ github.actor }}" --password-stdin
- name: Log in to registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITEA_TOKEN }}
- 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: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/amd64
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.tag }}
${{ 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"