-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (69 loc) · 2.42 KB
/
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
name: "Create release and publish packages to Sonatype"
on:
pull_request:
types: [opened, edited, synchronize]
#on:
# push:
# branches:
# - main
permissions:
contents: write
jobs:
check-for-release-file:
runs-on: ubuntu-latest
outputs:
has-release: ${{ steps.check-for-release-file.outputs.has-release }}
steps:
- uses: actions/checkout@v4
- name: Check for RELEASE.md file
id: check-for-release-file
run: |
if [ ! -f ./RELEASE.md ]; then
echo "has-release=false" >> $GITHUB_OUTPUT
echo "No release detected. Exiting."
exit 0
fi
echo "has-release=true" >> $GITHUB_OUTPUT
create-release:
runs-on: ubuntu-latest
needs: check-for-release-file
if: needs.check-for-release-file.outputs.has-release == 'true'
steps:
- uses: actions/checkout@v4
- name: Update CHANGELOG.md and build.sbt
run: |
git fetch --tags
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
python3 .github/scripts/create_release.py ${LATEST_TAG} $(pwd)
- name: Commit and push changes
run: |
NEW_TAG=$(cat CHANGELOG.md | grep -m1 -o 'v[0-9]\+\.[0-9]\+\.[0-9]\+')
git config --global user.name "GitHub on behalf of Wellcome Collection"
git config --global user.email "[email protected]"
git add CHANGELOG.md build.sbt
git rm RELEASE.md
git commit -m "Release: Bump version to ${NEW_TAG} and update changelog\n\n[skip ci]"
git tag "test-v${NEW_TAG}"
git push origin Publish-packages-to-sonatype
git push origin --tags
publish:
runs-on: ubuntu-latest
needs: [create-release, check-for-release-file]
if: needs.check-for-release-file.outputs.has-release == 'true'
strategy:
matrix:
service:
- http
- fixtures
steps:
- uses: actions/checkout@v4
with:
ref: new-release-process-test # Important!
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: eu-west-1
role-to-assume: ${{ secrets.GHA_SCALA_LIBS_ROLE_ARN }}
- uses: aws-actions/amazon-ecr-login@v2
- name: Publish to Sonatype
run: |
./builds/run_sbt_task_in_docker.sh "project ${{ matrix.service }}"; publishSigned; sonatypeBundleRelease