Skip to content

Commit d73b634

Browse files
authored
Add check-pr-release-file: need a change in release.txt to have a valid PR (#57)
1 parent e525ae5 commit d73b634

10 files changed

Lines changed: 125 additions & 51 deletions
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Check PR has release.txt in the list of modified files
2+
3+
## Description
4+
5+
Linked to the github action `release-github-actions`, we want to verify that the file release.txt has been updated before to merge a Pull request
6+
7+
## inputs
8+
9+
No inputs
10+
11+
## Refs
12+
13+
- https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads
14+
- https://github.com/marketplace/actions/changed-files
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Check - PR Release file
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
8+
jobs:
9+
check-pr:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 2
15+
- name: Get changed files
16+
id: changed-files
17+
uses: tj-actions/changed-files@v33
18+
- name: List all changed files
19+
run: |
20+
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
21+
echo "- $file"
22+
done
23+
- name: Test if release.txt is modified
24+
run: |
25+
if grep -q -w "release.txt" <<< "${{ steps.changed-files.outputs.all_changed_files }}"; then
26+
echo "release.txt is well in the list of modified files"
27+
exit 0
28+
else
29+
echo "release.txt is not in the list of modified files"
30+
exit 1
31+
fi

.github/workflows/demo-inherit-secret.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ This message is displayed because this reusable workflow recieved the secret dem
3131
3232
## Refs
3333
34-
https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idsecretsinherit
34+
- https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idsecretsinherit

.github/workflows/release-app.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Manage release creating PR on develop and main and creating release tag
2+
3+
## Description
4+
5+
This github action will manage release process creating:
6+
7+
- a release branch
8+
- a related tag
9+
- a github release
10+
- a pull request for develop
11+
- a pull request for main
12+
13+
This workflow is reusable
14+
15+
## inputs
16+
17+
- scope: the scope will define how the version will be ecreased (prepatch, patch, preminor, minor, premajor, major, prerelease)
18+
19+
## Refs
20+
21+
- https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads
22+
- https://github.com/marketplace/actions/github-create-tag-release
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#
1717
# On PR created by the workflow, it's recommanded to use merge action instead of squash to keep main and develop sync to keep history between both
1818

19-
name: Gitflow - Release
19+
name: Release - App
2020

2121
on:
2222
workflow_call:
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Check PR has release.txt in the list of modified files
2+
3+
## Description
4+
5+
Linked to the github action `release-github-actions`, we want to verify that the file release.txt has been updated before to merge a Pull request
6+
7+
## inputs
8+
9+
No inputs
10+
11+
## Refs
12+
13+
- https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads
14+
- https://github.com/marketplace/actions/changed-files
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Release - Github Actions
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
8+
jobs:
9+
list-of-action-to-release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 2
16+
17+
- name: Display info
18+
run: |
19+
echo "Github event ref branch : ${{ github.event.ref }}"
20+
echo "Github actor : $GITHUB_ACTOR"
21+
echo "Github branch : ${GITHUB_REF#refs/heads/}"
22+
23+
- name: Fetch tags
24+
run: |
25+
git fetch --tag
26+
27+
- name: Create tags
28+
run: |
29+
versions=$(cat ./release.txt)
30+
31+
while read n; do
32+
echo "Name $n"
33+
if grep -q -w $n <<< $(git tag -l); then
34+
echo "$n already exist"
35+
else
36+
git tag $n
37+
fi
38+
git push --tag
39+
done <<< "$versions"

.github/workflows/releaseAction.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

release.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
gitflow-release_v0.2.0
1+
check-pr-release-file_v0.1.0
22
demo-inherit-secret_v0.1.0
3-
releaseAction_v0.1.0
3+
release-app_v0.2.1
4+
release-github-actions_v0.1.1

scripts/releaseAction/script.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)