-
Notifications
You must be signed in to change notification settings - Fork 29
106 lines (100 loc) · 3.17 KB
/
release.yaml
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
98
99
100
101
102
103
104
105
106
name: Release
on:
workflow_dispatch:
inputs:
release-to-pypi:
required: false
type: boolean
default: false
defaults:
run:
shell: bash
jobs:
build:
uses: ./.github/workflows/build-and-test.yaml
with:
release: true
release-to-pypi: ${{ inputs.release-to-pypi }}
publish-release-and-bump-commit:
runs-on: ubuntu-latest
needs:
- build
steps:
- name: install git
run: |
if ! which git &>/dev/null; then
apt-get install git -y
fi
- uses: actions/checkout@v4
- name: Import Release-Commit
uses: ./.github/actions/import-commit
with:
commit-objects: ${{ needs.build.outputs.release-commit-objects }}
commit-digest: ${{ needs.build.outputs.release-commit-digest }}
- name: Push Release and Bump-Commits
id: releasecommit
run: |
echo "gha-creds*" >> .git/info/exclude
git config --global --add safe.directory $PWD
git config user.name 'Gardener-CICD Bot'
git config user.email '[email protected]'
effective_version=${{ needs.build.outputs.effective-version }}
commit_digest=$(git rev-parse @)
tgt_ref="refs/tags/${effective_version}"
echo "pushing release-commit ${commit_digest} to ${tgt_ref}"
git push origin "@:${tgt_ref}"
next_version=${{ needs.build.outputs.next-version }}
echo "next version: ${next_version}"
git reset --hard @~
echo "${next_version}" | .ci/write-version
git add .
git commit -m"Prepare next Dev-Cycle ${next_version}"
git pull --rebase
git push origin
- name: Retrieve Documentation
uses: actions/download-artifact@v4
with:
name: documentation
path: /tmp/documentation-out.d
- name: Publish Documentation
run: |
git fetch origin gh-pages
git checkout gh-pages
git clean -dfx
git status
echo "let's hope our worktree is clean"
tar c -C /tmp/documentation-out.d . | tar x -C.
git status
if [ -z "$(git status --porcelain)" ]; then
echo "no changes in documentation - no need to update documentation"
git checkout master # needed for post-gar
exit 0
fi
git add -A
git commit -m "update documentation"
git push origin refs/heads/gh-pages
git checkout master # needed for post-gar
pypi:
if: ${{ inputs.release-to-pypi }}
runs-on: ubuntu-latest
name: Publish to PYPI
needs:
- build
permissions:
contents: read
id-token: write
steps:
- name: Retrieve Distribution Packages
uses: actions/download-artifact@v4
with:
name: distribution-packages
path: /tmp/dist
- name: prepare build-filesystem
id: prepare
run: |
cp -r /tmp/dist .
ls -lta dist/
rm -rf dist/blobs.d dist/ocm_resources.yaml
ls -lta dist/
- name: publish to pypi
uses: pypa/gh-action-pypi-publish@release/v1