Skip to content

Commit 5f452a1

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents e76dba3 + 41aa123 commit 5f452a1

File tree

1 file changed

+34
-55
lines changed

1 file changed

+34
-55
lines changed

.github/workflows/ci.yml

Lines changed: 34 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,70 @@
1-
name: CI
1+
name: Release
22

33
on:
44
push:
55
tags:
6-
- "*"
7-
release:
8-
types:
9-
- created
10-
branches:
11-
- "releases/v3.x"
12-
- "chore/fix-ci"
13-
pull_request:
14-
branches:
15-
- "releases/v3.x"
16-
- "chore/fix-ci"
6+
- "v*"
177
workflow_dispatch:
188
inputs:
199
tag:
2010
description: 'Tag to run the workflow for'
2111
required: false
2212
default: ''
2313

14+
permissions:
15+
contents: read
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
2421
jobs:
2522
docker:
23+
name: Build Neutron Image
2624
runs-on:
2725
group: Neutron-Core
26+
timeout-minutes: 30
2827
env:
29-
DOCKER_BUILDKIT: 1
28+
INPUT_TAG: ${{ github.event.inputs.tag }}
3029

3130
steps:
3231
- name: Checkout
33-
uses: actions/checkout@v4
32+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
3433
with:
3534
fetch-depth: 0
3635
ref: ${{ github.event.inputs.tag || github.ref }}
3736

38-
- name: Install dependencies
39-
run: sudo apt-get update && sudo apt-get install -y jq curl git
40-
41-
- name: Install Go
42-
run: |
43-
GO_VERSION=1.23.4
44-
curl -LO https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz
45-
sudo tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz
46-
echo "export PATH=$PATH:/usr/local/go/bin" >> $HOME/.profile
47-
source $HOME/.profile
48-
shell: bash
49-
50-
- name: Download Buildx with Hydrobuilder support
51-
run: |
52-
ARCH=amd64
53-
BUILDX_URL=$(curl -s https://raw.githubusercontent.com/docker/actions-toolkit/main/.github/buildx-lab-releases.json | jq -r ".latest.assets[] | select(endswith(\"linux-$ARCH\"))")
54-
mkdir -vp ~/.docker/cli-plugins/
55-
curl --silent -L --output ~/.docker/cli-plugins/docker-buildx $BUILDX_URL
56-
chmod a+x ~/.docker/cli-plugins/docker-buildx
37+
- name: Set up Go
38+
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
39+
with:
40+
go-version-file: 'go.mod'
5741

58-
- name: Get version from git tags or input
42+
- name: Get version
5943
id: get_version
6044
run: |
61-
if [ -n "${{ github.event.inputs.tag }}" ]; then
62-
VERSION=${{ github.event.inputs.tag }}
45+
if [ -n "$INPUT_TAG" ]; then
46+
VERSION="$INPUT_TAG"
6347
else
6448
VERSION=$(git describe --tags --abbrev=0)
6549
fi
66-
echo "VERSION=$VERSION" >> $GITHUB_ENV
50+
if [ -z "$VERSION" ]; then
51+
echo "::error::Failed to determine version"
52+
exit 1
53+
fi
54+
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
6755
6856
- name: Log in to Docker Hub
69-
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
70-
71-
- name: Set up Docker Buildx
72-
id: buildx
73-
uses: docker/setup-buildx-action@v3
57+
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
7458
with:
75-
version: "lab:latest"
76-
driver: cloud
77-
endpoint: "neutronorg/neutron"
78-
install: true
59+
username: ${{ secrets.DOCKERHUB_USERNAME }}
60+
password: ${{ secrets.DOCKERHUB_TOKEN }}
7961

80-
- name: Build and push Docker image
62+
- name: Build Docker image
63+
run: make build-static-linux-amd64
64+
65+
- name: Push Docker image
8166
env:
8267
VERSION: ${{ env.VERSION }}
83-
BUILDER: ${{ steps.buildx.outputs.name }}
8468
run: |
85-
docker buildx use $BUILDER
86-
make build-static-linux-amd64
87-
docker tag neutron-amd64:latest neutronorg/neutron:${{ env.VERSION }}
88-
docker push neutronorg/neutron:${{ env.VERSION }}
89-
90-
- name: Cleanup temporary container
91-
run: docker rm -f neutronbinary || true
69+
docker tag neutron-amd64:latest "neutronorg/neutron:${VERSION}"
70+
docker push "neutronorg/neutron:${VERSION}"

0 commit comments

Comments
 (0)