-
Notifications
You must be signed in to change notification settings - Fork 1
97 lines (80 loc) · 2.98 KB
/
Copy pathcd_release.yml
File metadata and controls
97 lines (80 loc) · 2.98 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: CD - Release
on:
push:
branches: [master]
concurrency: ${{ github.workflow }}-${{ github.ref }}
env:
GIT_USER_NAME: "TEAM 4.0[bot]"
GIT_USER_EMAIL: "Team4.0@SINTEF.no"
DEFAULT_REPO_BRANCH: master
jobs:
update_version:
name: Update the version
if: github.repository_owner == 'EMMC-ASBL'
runs-on: ubuntu-latest
outputs:
continue_workflow: ${{ steps.update_version_step.outputs.continue_workflow }}
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_PAT }}
- name: Set up git config
run: |
git config --global user.name "${{ env.GIT_USER_NAME }}"
git config --global user.email "${{ env.GIT_USER_EMAIL }}"
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: "3.10"
- name: Install Python dependencies
run: |
python -m pip install -U pip
pip install -U setuptools wheel
pip install -U -r .dev/requirements_release.txt
- name: Update version
id: update_version_step
run: |
invoke setver
if [ -n "$(git status --porcelain app/__init__.py)" ]; then
echo "Version updated !"
CONTINUE_WORKFLOW=true
else
# The version has not changed - i.e. the workflow shouldn't continue.
echo "Version NOT updated !"
CONTINUE_WORKFLOW=false
fi
echo "continue_workflow=${CONTINUE_WORKFLOW}" >> $GITHUB_OUTPUT
- name: Update changelog
if: steps.update_version_step.outputs.continue_workflow == 'true'
uses: docker://githubchangeloggenerator/github-changelog-generator:1.16.2
with:
args: --user "${{ github.repository_owner }}" --project "oteapi-services" --token "${{ secrets.RELEASE_PAT }}" --release-branch "${{ env.DEFAULT_REPO_BRANCH }}" --exclude-labels "skip-changelog,duplicate,question,invalid,wontfix"
- name: Commit changes
if: steps.update_version_step.outputs.continue_workflow == 'true'
run: |
git add app/__init__.py CHANGELOG.md
git commit --amend -C HEAD
- name: Update '${{ env.DEFAULT_REPO_BRANCH }}'
if: steps.update_version_step.outputs.continue_workflow == 'true'
run: git push --force-with-lease origin ${{ env.DEFAULT_REPO_BRANCH }}
publish_container_image:
name: Publish Container image on GH Packages
needs: update_version
if: github.repository_owner == 'EMMC-ASBL' && needs.update_version.outputs.continue_workflow == 'true'
uses: ./.github/workflows/ci_cd_docker.yml
with:
source_ref: 'master' # Must match DEFAULT_REPO_BRANCH - env context not available here
image_name: oteapi
image_owner: emmc-asbl
registry_url: ghcr.io
secrets:
REGISTRY_USER: TEAM4-0
REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
PAT: ${{ secrets.RELEASE_PAT }}
permissions:
packages: write
contents: read