-
Notifications
You must be signed in to change notification settings - Fork 35
97 lines (73 loc) · 2.57 KB
/
build_test_publish_release.yml
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: 📦 Build Test Tag and Publish Release
on:
pull_request:
types:
- closed
branches:
- "mw-*"
permissions:
contents: write
packages: write
jobs:
_:
if: github.event.pull_request.merged == true
uses: ./.github/workflows/_build_test.yml
tag-release:
if: github.event.pull_request.merged == true
needs: _
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Git tag release
run: |
set -e # abort on error
set -x # show commands
set -o allexport
source ./variables.env
git config --global user.name 'wikibase suite github actions bot'
git config --global user.email 'wikibase-suite-github-actions-bot@users.noreply.github.com'
if git tag "$WMDE_RELEASE_VERSION"; then
git push --tags origin "$WMDE_RELEASE_VERSION"
else
echo "*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***"
echo "Cannot tag $WMDE_RELEASE_VERSION, Most probably this tag is already given to another commit."
echo "Make sure to update the WMDE_RELEASE_VERSION variable in variables.env to publish a new release."
echo "*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***"
fi
publish-dockerhub:
if: github.event.pull_request.merged == true
needs: tag-release
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/pull-ghcr
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/login-action@v3
with:
# implicitly docker hub
username: wmdetravisbot
password: ${{ secrets.WBS_PUBLISH_TOKEN }}
- name: Push release to dockerhub
run: |
set -x
source ./variables.env
source ./versions.inc.sh
docker image ls
images=(
"wikibase"
"wikibase-bundle"
"elasticsearch"
"wdqs"
"wdqs-frontend"
"wdqs-proxy"
"quickstatements"
)
for image in "${images[@]}"; do
image_path="wikibase/${image}"
url_run_id="ghcr.io/${{ github.repository_owner }}/${image_path}:dev-${{ github.run_id }}"
version_tag="$(image_version $image)"
docker tag "$url_run_id" "${image_path}:${version_tag}"
docker push "${image_path}:${version_tag}"
done