-
-
Notifications
You must be signed in to change notification settings - Fork 50
107 lines (95 loc) · 3.39 KB
/
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
98
99
100
101
102
103
104
105
106
107
name: Release distribution
on:
release:
types: [ created ]
jobs:
dangerKotlinLibrary-shadowJar:
name: Build Library
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 8
- name: danger-kotlin-library:shadowJar
run: ./gradlew danger-kotlin-library:shadowJar
- name: Upload Artifact lib
uses: actions/upload-artifact@v4
with:
name: lib
path: danger-kotlin-library/build/libs/danger-kotlin.jar
dangerKotlin-build-and-distribute:
name: Build and Attach binary to release
needs: [ dangerKotlinLibrary-shadowJar ]
strategy:
fail-fast: false
matrix:
target: [ { os: ubuntu-latest, compiler: linuxX64 }, { os: macos-latest, compiler: macosX64 }, { os: macos-latest, compiler: macosArm64 } ]
runs-on: ${{ matrix.target.os }}
steps:
- uses: actions/checkout@v4
- name: Download Artifact lib
uses: actions/download-artifact@v4
with:
name: lib
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 8
- name: danger-kotlin:build -PtargetOS="${{ matrix.target.compiler }}"
run: ./gradlew danger-kotlin:build -PtargetOS="${{ matrix.target.compiler }}"
- name: Prepare distribution package
run: |
mkdir -p lib/danger
mkdir -p bin
mv "danger-kotlin.jar" "lib/danger"
mv "danger-kotlin/build/bin/runner/releaseExecutable/danger-kotlin.kexe" "bin/danger-kotlin"
chmod +x bin/danger-kotlin
- name: Tar files
run: |
tar -cvf danger-kotlin-${{ matrix.target.compiler }}.tar bin lib
shasum -a 256 danger-kotlin-${{ matrix.target.compiler }}.tar
- name: Get release information
id: get_release
uses: bruceadams/get-release@v1.3.2
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload artifacts to release
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./danger-kotlin-${{ matrix.target.compiler }}.tar
asset_name: danger-kotlin-${{ matrix.target.compiler }}.tar
asset_content_type: application/x-tar
docker-build-push:
name: Build and Push Docker image
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
needs: [ dangerKotlin-build-and-distribute ]
steps:
- uses: actions/checkout@v4
- name: Get release information
id: get_release
uses: bruceadams/get-release@v1.3.2
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Docker Login
run: echo $PACKAGES_WRITE_TOKEN | docker login ghcr.io -u $USERNAME --password-stdin
env:
PACKAGES_WRITE_TOKEN: ${{ secrets.GITHUB_TOKEN }}
USERNAME: ${{ github.actor }}
- name: Docker Build
run: docker build -t ghcr.io/danger/danger-kotlin:$VERSION .
env:
VERSION: ${{ steps.get_release.outputs.tag_name }}
- name: Deploy
run: docker push ghcr.io/danger/danger-kotlin:$VERSION
env:
VERSION: ${{ steps.get_release.outputs.tag_name }}