-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (76 loc) · 2.32 KB
/
Copy pathcontainer.yml
File metadata and controls
82 lines (76 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Создание github containers
on:
push:
tags:
- "*"
workflow_dispatch:
jobs:
check-tags:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.version.outputs.tag }}
release: ${{ steps.version.outputs.release }}
steps:
- name: Скачивание репозитория
uses: actions/checkout@v4
with:
submodules: recursive
- name: Определение версии
id: version
run: |
tag=false
release=false
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
TAG_NAME="${GITHUB_REF#refs/tags/}"
echo "tag=$TAG_NAME" >> $GITHUB_OUTPUT
SEGMENTS=$(echo "$TAG_NAME" | tr '.' '\n' | wc -l)
if [ "$SEGMENTS" -le 3 ]; then
echo "release=true" >> $GITHUB_OUTPUT
else
echo "release=false" >> $GITHUB_OUTPUT
fi
else
echo "tag=false" >> $GITHUB_OUTPUT
echo "release=false" >> $GITHUB_OUTPUT
fi
build:
needs: check-tags
if: needs.check-tags.outputs.tag != 'false'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Скачивание репозитория
uses: actions/checkout@v4
with:
submodules: recursive
- name: Вход в GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Сборка и публикация образа
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository }}:${{ needs.check-tags.outputs.tag }}
ghcr.io/${{ github.repository }}:latest
create-release:
runs-on: ubuntu-latest
needs: check-tags
if: needs.check-tags.outputs.release == 'true'
permissions:
contents: write
steps:
- name: Создание релиза
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.check-tags.outputs.tag }}
name: Релиз ${{ needs.check-tags.outputs.tag }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}