Skip to content

Commit 2836210

Browse files
authored
ci: various CI improvements (#312)
1 parent cdd5978 commit 2836210

File tree

4 files changed

+32
-32
lines changed

4 files changed

+32
-32
lines changed

.github/workflows/e2e.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: E2E
22

33
on:
4+
push:
5+
branches: [main]
46
pull_request:
57
types: [opened, synchronize, reopened, labeled]
68

@@ -10,15 +12,15 @@ permissions:
1012

1113
jobs:
1214
build-gateway:
13-
if: contains(github.event.pull_request.labels.*.name, 'e2e')
15+
if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'e2e')
1416
uses: ./.github/workflows/docker-build.yml
1517
with:
1618
component: gateway
1719
platform: linux/arm64
1820
runner: build-arm64
1921

2022
build-cluster:
21-
if: contains(github.event.pull_request.labels.*.name, 'e2e')
23+
if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'e2e')
2224
uses: ./.github/workflows/docker-build.yml
2325
with:
2426
component: cluster

.github/workflows/release-canary.yml

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -72,38 +72,10 @@ jobs:
7272
fi
7373
7474
- name: Install CLI from GitHub Release
75-
run: |
76-
set -euo pipefail
77-
TAG="${{ steps.release.outputs.tag }}"
78-
ASSET_NAME="openshell-${{ matrix.target }}.tar.gz"
79-
API="https://api.github.com/repos/${{ github.repository }}"
80-
81-
echo "Downloading ${ASSET_NAME} from release ${TAG}..."
82-
83-
# Look up the asset download URL via the releases API
84-
ASSET_URL=$(curl -fsSL \
85-
-H "Authorization: token ${GH_TOKEN}" \
86-
"${API}/releases/tags/${TAG}" \
87-
| jq -r --arg name "${ASSET_NAME}" \
88-
'.assets[] | select(.name == $name) | .url')
89-
90-
if [ -z "$ASSET_URL" ] || [ "$ASSET_URL" = "null" ]; then
91-
echo "::error::Asset ${ASSET_NAME} not found in release ${TAG}"
92-
exit 1
93-
fi
94-
95-
# Download the asset binary
96-
curl -fsSL \
97-
-H "Authorization: token ${GH_TOKEN}" \
98-
-H "Accept: application/octet-stream" \
99-
-o "/tmp/${ASSET_NAME}" \
100-
"${ASSET_URL}"
101-
102-
tar -xzf "/tmp/${ASSET_NAME}" -C /tmp
103-
install -m 755 /tmp/openshell /usr/local/bin/openshell
104-
rm -f "/tmp/${ASSET_NAME}" /tmp/openshell
75+
run: ./install.sh
10576
env:
10677
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
OPENSHELL_VERSION: ${{ steps.release.outputs.tag }}
10779

10880
- name: Verify CLI installation
10981
run: openshell --version

.github/workflows/release-tag.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
cargo_version: ${{ steps.v.outputs.cargo }}
3232
# Semver without 'v' prefix (e.g. 0.6.0), used for image tags and release body
3333
semver: ${{ steps.v.outputs.semver }}
34+
previous_tag: ${{ steps.prev.outputs.tag }}
3435
steps:
3536
- uses: actions/checkout@v4
3637
with:
@@ -50,6 +51,19 @@ jobs:
5051
echo "cargo=$(uv run python tasks/scripts/release.py get-version --cargo)" >> "$GITHUB_OUTPUT"
5152
echo "semver=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
5253
54+
- name: Find previous release tag
55+
id: prev
56+
run: |
57+
set -euo pipefail
58+
# List tags matching v*.*.* sorted by version descending, keep only
59+
# stable releases (no pre-release suffixes like -rc1), skip the current tag
60+
PREV=$(git tag --list 'v*.*.*' --sort=-version:refname \
61+
| grep -P '^v\d+\.\d+\.\d+$' \
62+
| grep -v "^${GITHUB_REF_NAME}$" \
63+
| head -n1 || true)
64+
echo "tag=${PREV}" >> "$GITHUB_OUTPUT"
65+
echo "Previous release tag: ${PREV:-"(none, first release)"}"
66+
5367
build-gateway:
5468
needs: [compute-versions]
5569
uses: ./.github/workflows/docker-build.yml
@@ -413,6 +427,8 @@ jobs:
413427
body: |
414428
## OpenShell ${{ github.ref_name }}
415429
430+
${{ needs.compute-versions.outputs.previous_tag != '' && format('**Full changelog**: [{0}...{1}](https://github.com/{2}/compare/{0}...{1})', needs.compute-versions.outputs.previous_tag, github.ref_name, github.repository) || '' }}
431+
416432
### Quick install
417433
418434
Requires the [GitHub CLI (`gh`)](https://cli.github.com) to be installed and authenticated.

deploy/docker/Dockerfile.ci

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ RUN case "$TARGETARCH" in \
4949
-o /usr/local/lib/docker/cli-plugins/docker-buildx \
5050
&& chmod +x /usr/local/lib/docker/cli-plugins/docker-buildx
5151

52+
# Install GitHub CLI used by install.sh and CI jobs
53+
ARG GH_VERSION=2.74.1
54+
RUN case "$TARGETARCH" in \
55+
amd64) gh_arch=amd64 ;; \
56+
arm64) gh_arch=arm64 ;; \
57+
*) echo "Unsupported TARGETARCH: $TARGETARCH"; exit 1 ;; \
58+
esac \
59+
&& curl -fsSL "https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_${gh_arch}.tar.gz" \
60+
| tar xz --strip-components=2 -C /usr/local/bin "gh_${GH_VERSION}_linux_${gh_arch}/bin/gh"
61+
5262
# Install AWS CLI v2 used for ECR publishing
5363
RUN case "$TARGETARCH" in \
5464
amd64) aws_arch=x86_64 ;; \

0 commit comments

Comments
 (0)