Skip to content

Release distribution #21

Release distribution

Release distribution #21

Workflow file for this run

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/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload artifacts to release
uses: actions/[email protected]
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/[email protected]
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 }}