Skip to content

Commit 54c1ee6

Browse files
authored
Change image to publish on tag (not push to master) (#98)
1 parent 15c84d0 commit 54c1ee6

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,22 @@ on:
2121
jobs:
2222
format-build-test:
2323
runs-on: ubicloud
24-
timeout-minutes: 45
24+
timeout-minutes: 15
2525
steps:
2626
- name: Check out
27-
uses: actions/checkout@v2
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
2830
- name: Config rust toolchain
2931
run: |
3032
rustup update stable && rustup default stable
31-
rustup component add rustfmt
3233
rustup show active-toolchain
33-
rustup install 1.76.0-x86_64-unknown-linux-gnu
3434
- name: Format
3535
run: cargo fmt --all -- --check
3636
- name: install libdrift_ffi_sys
3737
run: |
38-
curl -L https://github.com/user-attachments/files/17849111/libdrift_ffi_sys.so.zip > ffi.zip && unzip ffi.zip
39-
sudo cp libdrift_ffi_sys.so /usr/lib/
38+
curl -L https://github.com/drift-labs/drift-ffi-sys/releases/download/v2.103.0/libdrift_ffi_sys.so.zip > ffi.zip && unzip ffi.zip
39+
sudo cp libdrift_ffi_sys.so /lib/
4040
- uses: ubicloud/rust-cache@v2
4141
with:
4242
path: |

.github/workflows/release.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ name: Release
22

33
on:
44
push:
5-
branches:
6-
- "master"
5+
tags:
6+
- 'v*.*.*'
7+
78
env:
89
REGISTRY: ghcr.io
910
IMAGE_NAME: ${{ github.repository }}
@@ -18,13 +19,23 @@ jobs:
1819
timeout-minutes: 45
1920
steps:
2021
- name: Check out
21-
uses: actions/checkout@v2
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
2225
- name: Build image
2326
run: |
24-
VERSION_TAG=$(grep -Po -m1 '\d.\d.\d' Cargo.toml)
27+
CARGO_VERSION=$(grep -Po '(?<=version = ")\d+\.\d+\.\d+' Cargo.toml)
28+
TAG_VERSION=${GITHUB_REF#refs/tags/v}
29+
30+
if [ "$CARGO_VERSION" != "$TAG_VERSION" ]; then
31+
echo "Version mismatch: Cargo.toml version ($CARGO_VERSION) doesn't match tag version ($TAG_VERSION)"
32+
exit 1
33+
fi
34+
echo "Version $CARGO_VERSION matches tag"
35+
2536
docker build -f Dockerfile .\
2637
-t "${REGISTRY}/${IMAGE_NAME}:${GITHUB_SHA::6}"\
27-
-t "${REGISTRY}/${IMAGE_NAME}:${VERSION_TAG}"\
38+
-t "${REGISTRY}/${IMAGE_NAME}:${TAG_VERSION}"\
2839
-t "${REGISTRY}/${IMAGE_NAME}:latest"
2940
env:
3041
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)