Skip to content

Commit 4012648

Browse files
authored
ci: fix palette-agent download url in install.sh (#4)
* ci: fix palette-agent download url in install.sh Signed-off-by: Nianyu Shen <[email protected]> * ci: upload artifact for non release build also Signed-off-by: Nianyu Shen <[email protected]> * fix: use ref_name instead of ref Signed-off-by: Nianyu Shen <[email protected]> * fix: use commit id as version for non tag Signed-off-by: Nianyu Shen <[email protected]> * fix: remove deprecated flags in Earthfile Signed-off-by: Nianyu Shen <[email protected]> * ci: split pr and release build Signed-off-by: Nianyu Shen <[email protected]> * ci: upload install script for pr build Signed-off-by: Nianyu Shen <[email protected]> * ci: set overwrite for upload to true Signed-off-by: Nianyu Shen <[email protected]> * ci: remove upload artifacts for pr build Signed-off-by: Nianyu Shen <[email protected]> * ci: fix job name in build workflow Signed-off-by: Nianyu Shen <[email protected]> --------- Signed-off-by: Nianyu Shen <[email protected]>
1 parent 91c1d15 commit 4012648

File tree

3 files changed

+65
-14
lines changed

3 files changed

+65
-14
lines changed

.github/workflows/build.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
permissions:
10+
contents: write
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
- name: Set up QEMU
23+
uses: docker/setup-qemu-action@master
24+
with:
25+
platforms: all
26+
- name: Set up Docker Buildx
27+
id: buildx
28+
uses: docker/setup-buildx-action@master
29+
- name: Install earthly
30+
uses: earthly/actions-setup@v1
31+
with:
32+
github-token: ${{ secrets.GITHUB_TOKEN }}
33+
version: "latest"
34+
use-cache: true
35+
- name: Calculate Version
36+
id: version
37+
run: |
38+
echo $(git describe --exact-match --tags || echo "v0.0.0-$(git rev-parse --short=8 HEAD)") > VERSION
39+
echo "version=$(head -n 1 VERSION)" >> $GITHUB_OUTPUT
40+
- name: Build artifacts
41+
env:
42+
VERSION: ${{ steps.version.outputs.version }}
43+
run: |
44+
earthly --ci --output +release

.github/workflows/release.yaml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
name: Release
1+
name: release
22

33
on:
44
push:
5+
tags:
6+
- v*
57

68
permissions:
79
contents: write
@@ -29,10 +31,13 @@ jobs:
2931
github-token: ${{ secrets.GITHUB_TOKEN }}
3032
version: "latest"
3133
use-cache: true
32-
- name: Run Release target
33-
run: earthly --ci --output +release
34-
- name: Release
34+
- name: Build artifacts
35+
env:
36+
VERSION: ${{ github.ref_name}}
37+
run: |
38+
earthly --ci --output +release
39+
- name: Upload release artifacts
3540
uses: softprops/action-gh-release@v2
36-
if: startsWith(github.ref, 'refs/tags/')
41+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
3742
with:
38-
files: build/*
43+
files: build/*

Earthfile

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ release:
1414
--PLATFORM=linux \
1515
--ARCH=amd64 \
1616
--ARCH=arm64
17-
17+
1818
BUILD +install-script
1919

2020
ubuntu:
@@ -27,7 +27,7 @@ stylus-image:
2727
ARG ARCH=amd64
2828
ARG STYLUS_IMAGE
2929
FROM --platform=$PLATFORM/$ARCH $STYLUS_IMAGE
30-
SAVE ARTIFACT --keep-own ./*
30+
SAVE ARTIFACT ./*
3131

3232
palette-agent:
3333
FROM +ubuntu
@@ -41,7 +41,7 @@ palette-agent:
4141
COPY (+stylus-image/opt/spectrocloud/bin/palette-agent --PLATFORM=${PLATFORM} --ARCH=${ARCH} --STYLUS_IMAGE=${STYLUS_IMAGE}) /workdir/
4242
RUN chmod +x /workdir/palette-agent
4343

44-
SAVE ARTIFACT --keep-own /workdir/palette-agent AS LOCAL ./build/palette-agent-${PLATFORM}-${ARCH}
44+
SAVE ARTIFACT /workdir/palette-agent AS LOCAL ./build/palette-agent-${PLATFORM}-${ARCH}
4545

4646
package-tar:
4747
FROM +ubuntu
@@ -76,12 +76,14 @@ package-tar:
7676

7777
install-script:
7878
FROM +ubuntu
79-
80-
ARG VERSION=$(head -n 1 PE_VERSION)
79+
80+
ARG VERSION
81+
ARG PE_VERSION=$(head -n 1 PE_VERSION)
8182
ARG IMAGE_REPO=${SPECTRO_PUB_REPO}/edge
82-
ARG AGENT_URL_PREFIX=https://github.com/spectrocloud/agent-mode/releases/latest/download
83+
# https://github.com/spectrocloud/agent-mode/releases/download/v4.5.0-rc2/palette-agent-linux-amd64
84+
ARG AGENT_URL_PREFIX=https://github.com/spectrocloud/agent-mode/releases/download/${VERSION}
8385

84-
ENV PE_VERSION=${VERSION}
86+
ENV PE_VERSION=${PE_VERSION}
8587
ENV IMAGE_REPO=${IMAGE_REPO}
8688
ENV AGENT_URL_PREFIX=${AGENT_URL_PREFIX}
8789

@@ -90,4 +92,4 @@ install-script:
9092
RUN envsubst '${PE_VERSION} ${IMAGE_REPO} ${AGENT_URL_PREFIX}' < /workdir/install.sh.tmpl > /workdir/install.sh
9193
RUN chmod +x /workdir/install.sh
9294

93-
SAVE ARTIFACT --keep-own /workdir/install.sh AS LOCAL ./build/install.sh
95+
SAVE ARTIFACT /workdir/install.sh AS LOCAL ./build/install.sh

0 commit comments

Comments
 (0)