-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (46 loc) · 1.52 KB
/
ci-release.yml
File metadata and controls
53 lines (46 loc) · 1.52 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
name: Workflow sur le master
on:
push:
branches:
- master
permissions:
contents: write # pour release et tag
issues: write # pour commenter les issues
pull-requests: write # pour gérer les PR
jobs:
workflow_push_on_main:
runs-on: ubuntu-latest
steps:
- name: Checkout du code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Vérifier s'il s'agit du commit initial
id: check_initial_commit
run: |
if [ $(git rev-list --count HEAD) -eq 1 ]; then
echo "is_initial_commit=true" >> $GITHUB_ENV
else
echo "is_initial_commit=false" >> $GITHUB_ENV
fi
- name: Modifier le message du commit initial
if: env.is_initial_commit == 'true'
run: |
git config user.name "CI GITHUB"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git commit --amend -m "chore: initial commit"
git push --force
- name: Créer un tag pour le commit initial
if: env.is_initial_commit == 'true'
run: |
git tag v0.1.0
git push origin v0.1.0
- name: Créer la branche develop
if: env.is_initial_commit == 'true'
run: |
git config --global user.name "CI GITHUB"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git checkout -b develop
git push origin develop
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}