Compare commits
10 Commits
89d58e9696
...
v0.1.21
Author | SHA1 | Date | |
---|---|---|---|
76d54cb433 | |||
4dc8c56a5c | |||
c81040b16b | |||
68c307e258 | |||
5d00f072d8 | |||
9072e253ec | |||
063ad113d7 | |||
097be0f555 | |||
c7b8e24a54 | |||
fb1d016b36 |
@@ -3,7 +3,7 @@ name: Rust Cross-Platform Build
|
|||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches: [ "development", "main", "feature/*", "bugfix/*", "enhancement/*" ]
|
branches: [ "development", "main", "staging" ]
|
||||||
tags: [ "v*.*.*" ]
|
tags: [ "v*.*.*" ]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
@@ -152,10 +152,11 @@ jobs:
|
|||||||
set-tag:
|
set-tag:
|
||||||
name: Set Tag Name
|
name: Set Tag Name
|
||||||
needs: [detect-project, build]
|
needs: [detect-project, build]
|
||||||
if: ${{ !failure() && !cancelled() && github.event_name != 'pull_request' }}
|
#if: ${{ !failure() && !cancelled() && github.event_name != 'pull_request' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
tag_name: ${{ steps.set_tag.outputs.tag_name }}
|
tag_name: ${{ steps.set_tag.outputs.tag_name }}
|
||||||
|
should_tag: ${{ steps.set_tag.outputs.should_tag }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -179,30 +180,35 @@ jobs:
|
|||||||
major=$((major + 1))
|
major=$((major + 1))
|
||||||
minor=0
|
minor=0
|
||||||
patch=0
|
patch=0
|
||||||
|
new_tag="v${major}.${minor}.${patch}"
|
||||||
|
echo "tag_name=${new_tag}" >> $GITHUB_OUTPUT
|
||||||
|
echo "should_tag=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "Creating new major version tag: ${new_tag}"
|
||||||
|
|
||||||
elif [[ "${GITHUB_REF}" == "refs/heads/development" ]]; then
|
elif [[ "${GITHUB_REF}" == "refs/heads/development" ]]; then
|
||||||
minor=$((minor + 1))
|
minor=$((minor + 1))
|
||||||
patch=0
|
patch=0
|
||||||
elif [[ "${GITHUB_REF}" == "refs/heads/staging" ]]; then
|
|
||||||
patch=$((patch + 1))
|
|
||||||
else
|
|
||||||
echo "Not on main, development, or staging branch. Using latest tag: $latest_tag"
|
|
||||||
echo "Not building docker image for this branch."
|
|
||||||
new_tag="$latest_tag"
|
|
||||||
echo "tag_name=${new_tag}" >> $GITHUB_OUTPUT
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
new_tag="v${major}.${minor}.${patch}"
|
new_tag="v${major}.${minor}.${patch}"
|
||||||
echo "tag_name=${new_tag}" >> $GITHUB_OUTPUT
|
echo "tag_name=${new_tag}" >> $GITHUB_OUTPUT
|
||||||
|
echo "should_tag=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "Creating new minor version tag: ${new_tag}"
|
||||||
|
|
||||||
|
elif [[ "${GITHUB_REF}" == "refs/heads/staging" ]]; then
|
||||||
|
patch=$((patch + 1))
|
||||||
|
new_tag="v${major}.${minor}.${patch}"
|
||||||
|
echo "tag_name=${new_tag}" >> $GITHUB_OUTPUT
|
||||||
|
echo "should_tag=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "Creating new patch version tag: ${new_tag}"
|
||||||
|
fi
|
||||||
|
|
||||||
docker-build:
|
docker-build:
|
||||||
name: Build and Push Docker Image
|
name: Build and Push Docker Image
|
||||||
needs: [detect-project, build, set-tag]
|
needs: [detect-project, build, set-tag]
|
||||||
#if: |
|
if: |
|
||||||
# always() &&
|
needs.detect-project.result == 'success' &&
|
||||||
# needs.detect-project.result == 'success' &&
|
needs.build.result == 'success' &&
|
||||||
# needs.build.result == 'success' &&
|
needs.set-tag.outputs.should_tag == 'true' &&
|
||||||
# github.event_name != 'pull_request'
|
github.event_name != 'pull_request'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
environment: production
|
environment: production
|
||||||
steps:
|
steps:
|
||||||
@@ -254,10 +260,10 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
|
echo "Creating new tag: ${{ needs.set-tag.outputs.tag_name }}"
|
||||||
git tag ${{ needs.set-tag.outputs.tag_name }}
|
git tag ${{ needs.set-tag.outputs.tag_name }}
|
||||||
git push origin ${{ needs.set-tag.outputs.tag_name }}
|
git push origin ${{ needs.set-tag.outputs.tag_name }}
|
||||||
|
|
||||||
|
|
||||||
summary:
|
summary:
|
||||||
name: Workflow Summary
|
name: Workflow Summary
|
||||||
needs: [test, build, docker-build]
|
needs: [test, build, docker-build]
|
@@ -55,7 +55,7 @@ impl DockerManager {
|
|||||||
|
|
||||||
Ok(containers
|
Ok(containers
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.find(|c| c.image == client_image)
|
.find(|c| c.image.contains(client_image))
|
||||||
.map(|container| DockerContainerDto {
|
.map(|container| DockerContainerDto {
|
||||||
id: container.id,
|
id: container.id,
|
||||||
image: container.image,
|
image: container.image,
|
||||||
@@ -68,11 +68,11 @@ impl DockerManager {
|
|||||||
match self.get_client_container().await {
|
match self.get_client_container().await {
|
||||||
Ok(Some(container)) => container.image,
|
Ok(Some(container)) => container.image,
|
||||||
Ok(None) => {
|
Ok(None) => {
|
||||||
eprintln!("Warning: No WatcherAgent container found");
|
println!("Warning: No WatcherAgent container found");
|
||||||
"unknown".to_string()
|
"unknown".to_string()
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
eprintln!("Warning: Could not get current image version: {}", e);
|
println!("Warning: Could not get current image version: {}", e);
|
||||||
"unknown".to_string()
|
"unknown".to_string()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user