Skip to content

Commit 5f678c7

Browse files
committed
Обновлен деплой в Pages
1 parent 3b48b42 commit 5f678c7

1 file changed

Lines changed: 33 additions & 10 deletions

File tree

.github/workflows/static.yml

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,53 @@
1-
# Simple workflow for deploying static content to GitHub Pages
21
name: Deploy static content to Pages
32

43
on:
5-
# Runs on pushes targeting the default branch
64
push:
7-
branches: ["main"]
8-
9-
# Allows you to run this workflow manually from the Actions tab
5+
tags:
6+
- '*'
107
workflow_dispatch:
118

12-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
139
permissions:
1410
contents: read
1511
pages: write
1612
id-token: write
1713

18-
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19-
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
2014
concurrency:
2115
group: "pages"
2216
cancel-in-progress: false
2317

2418
jobs:
25-
# Single deploy job since we're just deploying
19+
check-tags:
20+
runs-on: ubuntu-latest
21+
outputs:
22+
tag: ${{ steps.version.outputs.tag }}
23+
release: ${{ steps.version.outputs.release }}
24+
steps:
25+
- name: Скачивание репозитория
26+
uses: actions/checkout@v4
27+
28+
- name: Определение версии
29+
id: version
30+
run: |
31+
tag=false
32+
release=false
33+
# Определяем, что было выбрано: branch или tag
34+
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
35+
TAG_NAME="${GITHUB_REF#refs/tags/}"
36+
echo "tag=$TAG_NAME" >> $GITHUB_OUTPUT
37+
SEGMENTS=$(echo "$TAG_NAME" | tr '.' '\n' | wc -l)
38+
if [ "$SEGMENTS" -le 3 ]; then
39+
echo "release=true" >> $GITHUB_OUTPUT
40+
else
41+
echo "release=false" >> $GITHUB_OUTPUT
42+
fi
43+
else
44+
echo "tag=false" >> $GITHUB_OUTPUT
45+
echo "release=false" >> $GITHUB_OUTPUT
46+
fi
47+
2648
deploy:
49+
needs: check-tags
50+
if: needs.check-tags.outputs.tag != 'false'
2751
environment:
2852
name: github-pages
2953
url: ${{ steps.deployment.outputs.page_url }}
@@ -36,7 +60,6 @@ jobs:
3660
- name: Upload artifact
3761
uses: actions/upload-pages-artifact@v3
3862
with:
39-
# Upload entire repository
4063
path: 'web'
4164
- name: Deploy to GitHub Pages
4265
id: deployment

0 commit comments

Comments
 (0)