generated from MacroPower/go_template
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (74 loc) · 2.38 KB
/
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
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