Set up QEMU, buildx #30
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release | |
on: | |
push: | |
tags: | |
- v* | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: Tag to release | |
required: true | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
goreleaser: | |
name: goreleaser | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.tag != '' && format('refs/tags/{0}', github.event.inputs.tag) || github.ref }} | |
fetch-depth: 0 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Set up devbox | |
uses: jetify-com/[email protected] | |
with: | |
enable-cache: true | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: "${{ github.actor }}" | |
password: "${{ secrets.GITHUB_TOKEN }}" | |
- name: Release in devbox | |
run: devbox run -- task go-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
kcl-mod: | |
name: kcl-mod | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.tag != '' && format('refs/tags/{0}', github.event.inputs.tag) || github.ref }} | |
fetch-depth: 0 | |
- name: Set up KCL | |
run: wget -q https://kcl-lang.io/script/install-cli.sh -O - | /bin/bash | |
- name: Login to GitHub Container Registry | |
run: kcl registry login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io | |
- name: Publish KCL packages | |
run: | | |
# Get the tag version without the 'v' prefix | |
VERSION=${GITHUB_REF#refs/tags/v} | |
# Find all directories under modules | |
for dir in ./modules/*/; do | |
if [ -d "$dir" ]; then | |
echo "Processing module: $dir" | |
cd "$dir" | |
if [ -f "kcl.mod" ]; then | |
PKG_NAME=$(basename $dir) | |
# Update the version in kcl.mod file | |
sed -i "s/^version = .*/version = \"${VERSION}\"/" "kcl.mod" | |
echo "Publishing module: $PKG_NAME" | |
cat kcl.mod | |
kcl mod push oci://ghcr.io/macropower/kclx/$PKG_NAME | |
fi | |
cd - | |
fi | |
done |