Skip to content

Update cats, circe to 4.0.0-M18 (#87) #97

Update cats, circe to 4.0.0-M18 (#87)

Update cats, circe to 4.0.0-M18 (#87) #97

Workflow file for this run

name: release
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
packages: write
env:
REGISTRY: ghcr.io
REGISTRY_IMAGE: ghcr.io/${{ github.repository }}
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
release-type: simple
manifest-file: '.github/release-please-manifest.json'
package:
needs: [release-please]
if: ${{ needs.release-please.outputs.release_created }}
runs-on: ${{ matrix.OS }}
strategy:
matrix:
OS: ['windows-latest', 'macos-latest']
include:
- os: macOS-latest
uploaded_filename: tgtg-macos-aaarch64
local_path: artifacts/tgtg-macos-aaarch64
- os: windows-latest
uploaded_filename: tgtg-win-amd64.exe
local_path: artifacts/tgtg-win-amd64.exe
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: coursier/cache-action@v6
- uses: VirtusLab/scala-cli-setup@v1
with:
power: true
jvm: 'temurin:21'
- name: Package app
run: scala-cli package . -o "${{ matrix.local_path }}" --native-image --graalvm-args -H:IncludeResources=version.txt
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.uploaded_filename }}
path: ${{ matrix.local_path }}
if-no-files-found: error
retention-days: 2
- name: Upload release artifacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ needs.release-please.outputs.tag_name }} ${{ matrix.local_path }}
package-linux:
needs: [release-please]
if: ${{ needs.release-please.outputs.release_created }}
runs-on: ${{ matrix.OS }}
strategy:
matrix:
OS: ['ubuntu-latest']
platforms:
- linux/amd64
- linux/arm/v7,linux/arm64/v8
include:
- platforms: linux/amd64
uploaded_filename: tgtg-linux-amd64
local_path: artifacts/tgtg-linux-amd64
digest-artifact: digests-linux-amd64
- platforms: linux/arm/v7,linux/arm64/v8
uploaded_filename: tgtg.jar
local_path: artifacts/tgtg.jar
digest-artifact: digests-linux-arm
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}
- uses: coursier/cache-action@v6
- uses: VirtusLab/scala-cli-setup@v1
with:
power: true
jvm: 'temurin:21'
- name: Package app
if: matrix.platforms == 'linux/amd64'
run: scala-cli package . -o "${{ matrix.local_path }}" --native-image -- -H:IncludeResources=version.txt --static
- name: Compress artifact
if: matrix.platforms == 'linux/amd64'
uses: crazy-max/ghaction-upx@v3
with:
args: --best
files: ${{ matrix.local_path }}
- name: Package app
if: matrix.platforms != 'linux/amd64'
run: |
mkdir -p $(dirname "${{ matrix.local_path }}")
scala-cli package . -o "${{ matrix.local_path }}" --assembly
- name: Build and push Docker image
uses: docker/build-push-action@v6
id: build
with:
file: ${{ matrix.platforms == 'linux/amd64' && './Dockerfile' || './arm.Dockerfile' }}
build-args: 'LOCAL_PATH=${{ matrix.local_path }}'
context: .
push: true
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ matrix.platforms }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.digest-artifact }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
- uses: actions/upload-artifact@v4
if: ${{ matrix.platforms != 'linux/arm64/v8' }}
with:
name: ${{ matrix.uploaded_filename }}
path: ${{ matrix.local_path }}
if-no-files-found: error
retention-days: 2
- name: Upload release artifacts
if: ${{ matrix.platforms != 'linux/arm64/v8' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ needs.release-please.outputs.tag_name }} ${{ matrix.local_path }}
# https://docs.docker.com/build/ci/github-actions/multi-platform/
merge:
runs-on: ubuntu-latest
if: ${{ needs.release-please.outputs.release_created }}
needs:
- release-please
- package-linux
steps:
- name: Download digest - linux/amd64
uses: actions/download-artifact@v4
with:
name: digests-linux-amd64
path: /tmp/digests
- name: Download digest - linux/arm
uses: actions/download-artifact@v4
with:
name: digests-linux-arm
path: /tmp/digests
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=raw,value=${{ needs.release-please.outputs.tag_name }}
type=raw,value=latest
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}