-
Notifications
You must be signed in to change notification settings - Fork 7
90 lines (74 loc) · 2.84 KB
/
build_and_publish.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
name: build and publish
on:
push:
branches:
- trunk
tags:
- '*'
env:
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4g -Dorg.gradle.daemon=false -Dkotlin.incremental=false"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gradle/actions/wrapper-validation@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
- uses: crazy-max/ghaction-docker-meta@v1
id: docker_meta
with:
images: |
jakewharton/dependency-watch
ghcr.io/jakewharton/dependency-watch
tag-semver: |
{{version}}
{{major}}
{{major}}.{{minor}}
- uses: docker/login-action@v3
with:
username: jakewharton
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- run: echo ${{ secrets.GHCR_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
- run: ./gradlew build
- uses: docker/build-push-action@v6
with:
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
- name: Get version
id: get_version
if: startsWith(github.ref, 'refs/tags/')
run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}
- name: Set SHA
id: shasum
if: startsWith(github.ref, 'refs/tags/')
run: echo ::set-output name=sha::"$(shasum -a 256 build/distributions/dependency-watch.zip | awk '{printf $1}')"
- name: Extract release notes
id: release_notes
if: startsWith(github.ref, 'refs/tags/')
uses: ffurrer2/extract-release-notes@v2
- name: Create Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
body: ${{ steps.release_notes.outputs.release_notes }}
files: build/distributions/dependency-watch.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Bump Brew
if: startsWith(github.ref, 'refs/tags/')
env:
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GHCR_TOKEN }}
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
# Update to ensure we have the latest version which supports arbitrary default branches.
brew update
brew tap JakeWharton/repo
brew bump-formula-pr -f --version=${{ steps.get_version.outputs.version }} --no-browse --no-audit \
--sha256=${{ steps.shasum.outputs.sha }} \
--url="https://github.com/JakeWharton/dependency-watch/releases/download/${{ steps.get_version.outputs.version }}/dependency-watch.zip" \
JakeWharton/repo/dependency-watch