Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change image to publish on tag #98

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@ on:
jobs:
format-build-test:
runs-on: ubicloud
timeout-minutes: 45
timeout-minutes: 15
steps:
- name: Check out
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Config rust toolchain
run: |
rustup update stable && rustup default stable
rustup component add rustfmt
rustup show active-toolchain
rustup install 1.76.0-x86_64-unknown-linux-gnu
- name: Format
run: cargo fmt --all -- --check
- name: install libdrift_ffi_sys
run: |
curl -L https://github.com/user-attachments/files/17849111/libdrift_ffi_sys.so.zip > ffi.zip && unzip ffi.zip
sudo cp libdrift_ffi_sys.so /usr/lib/
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
sudo cp libdrift_ffi_sys.so /lib/
- uses: ubicloud/rust-cache@v2
with:
path: |
Expand Down
21 changes: 16 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ name: Release

on:
push:
branches:
- "master"
tags:
- 'v*.*.*'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
Expand All @@ -18,13 +19,23 @@ jobs:
timeout-minutes: 45
steps:
- name: Check out
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build image
run: |
VERSION_TAG=$(grep -Po -m1 '\d.\d.\d' Cargo.toml)
CARGO_VERSION=$(grep -Po '(?<=version = ")\d+\.\d+\.\d+' Cargo.toml)
TAG_VERSION=${GITHUB_REF#refs/tags/v}

if [ "$CARGO_VERSION" != "$TAG_VERSION" ]; then
echo "Version mismatch: Cargo.toml version ($CARGO_VERSION) doesn't match tag version ($TAG_VERSION)"
exit 1
fi
echo "Version $CARGO_VERSION matches tag"

docker build -f Dockerfile .\
-t "${REGISTRY}/${IMAGE_NAME}:${GITHUB_SHA::6}"\
-t "${REGISTRY}/${IMAGE_NAME}:${VERSION_TAG}"\
-t "${REGISTRY}/${IMAGE_NAME}:${TAG_VERSION}"\
-t "${REGISTRY}/${IMAGE_NAME}:latest"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
Loading