Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
60e7136bcd
|
|||
99b5401c38
|
|||
b6c133bb54
|
|||
58a1a8ee2f
|
|||
bbeebda027
|
|||
267ec22c6f
|
|||
a95bf7a43e
|
|||
20de0927da
|
|||
4f8fe9e768
|
|||
15669c3861
|
@@ -11,51 +11,25 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
name: Build image
|
||||||
env:
|
runs-on: ubuntu-22.04
|
||||||
REGISTRY: hub.realmanual.ru
|
|
||||||
IMAGE_NAME: pub/sqlite-backup/backup
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Ensure tag commit is reachable from main
|
- name: Log in to the Container registry
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
git fetch --no-tags --depth=0 origin main
|
|
||||||
if git merge-base --is-ancestor "$GITHUB_SHA" origin/main; then
|
|
||||||
echo "Commit is on main history. Proceeding."
|
|
||||||
else
|
|
||||||
echo "Tag commit is not from main. Skipping build." >&2
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Extract tag
|
|
||||||
id: vars
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
TAG_REF="${GITHUB_REF#refs/tags/}"
|
|
||||||
echo "tag=$TAG_REF" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Log in to registry
|
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.REGISTRY }}
|
registry: git.realmanual.ru
|
||||||
username: ${{ github.actor }}
|
username: ${{ gitea.actor }}
|
||||||
password: ${{ secrets.GITEA_TOKEN }}
|
password: ${{ secrets.PUSH_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push Docker image
|
||||||
|
id: push
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
platforms: linux/amd64
|
|
||||||
tags: |
|
tags: |
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.tag }}
|
$GITHUB_REPOSITORY:${GITHUB_REF#refs/tags/}
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
$GITHUB_REPOSITORY:latest
|
||||||
|
Reference in New Issue
Block a user