Compare commits
2 Commits
c395885bbd
...
89d58e9696
Author | SHA1 | Date | |
---|---|---|---|
89d58e9696 | |||
45c6e8180c |
84
.github/workflows/build.yml
vendored
84
.github/workflows/build.yml
vendored
@@ -74,44 +74,6 @@ jobs:
|
|||||||
# working-directory: ${{ needs.detect-project.outputs.project-dir }}
|
# working-directory: ${{ needs.detect-project.outputs.project-dir }}
|
||||||
# run: cargo clippy -- -D warnings
|
# run: cargo clippy -- -D warnings
|
||||||
|
|
||||||
set-tag:
|
|
||||||
name: Set Tag Name
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
tag_name: ${{ steps.set_tag.outputs.tag_name }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Determine next semantic version tag
|
|
||||||
id: set_tag
|
|
||||||
run: |
|
|
||||||
git fetch --tags
|
|
||||||
|
|
||||||
# Find latest tag matching vX.Y.Z
|
|
||||||
latest_tag=$(git tag --list 'v*.*.*' --sort=-v:refname | head -n 1)
|
|
||||||
if [[ -z "$latest_tag" ]]; then
|
|
||||||
major=0
|
|
||||||
minor=0
|
|
||||||
patch=0
|
|
||||||
else
|
|
||||||
version="${latest_tag#v}"
|
|
||||||
IFS='.' read -r major minor patch <<< "$version"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then
|
|
||||||
major=$((major + 1))
|
|
||||||
minor=0
|
|
||||||
patch=0
|
|
||||||
elif [[ "${GITHUB_REF}" == "refs/heads/development" ]]; then
|
|
||||||
minor=$((minor + 1))
|
|
||||||
patch=0
|
|
||||||
else
|
|
||||||
patch=$((patch + 1))
|
|
||||||
fi
|
|
||||||
|
|
||||||
new_tag="v${major}.${minor}.${patch}"
|
|
||||||
echo "tag_name=${new_tag}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
# audit:
|
# audit:
|
||||||
# name: Security Audit
|
# name: Security Audit
|
||||||
# needs: [detect-project]
|
# needs: [detect-project]
|
||||||
@@ -187,6 +149,52 @@ jobs:
|
|||||||
path: |
|
path: |
|
||||||
${{ needs.detect-project.outputs.project-dir }}/target/${{ matrix.target }}/release/${{ needs.detect-project.outputs.project-name }}${{ matrix.os == 'windows' && '.exe' || '' }}
|
${{ needs.detect-project.outputs.project-dir }}/target/${{ matrix.target }}/release/${{ needs.detect-project.outputs.project-name }}${{ matrix.os == 'windows' && '.exe' || '' }}
|
||||||
|
|
||||||
|
set-tag:
|
||||||
|
name: Set Tag Name
|
||||||
|
needs: [detect-project, build]
|
||||||
|
if: ${{ !failure() && !cancelled() && github.event_name != 'pull_request' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
tag_name: ${{ steps.set_tag.outputs.tag_name }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Determine next semantic version tag
|
||||||
|
id: set_tag
|
||||||
|
run: |
|
||||||
|
git fetch --tags
|
||||||
|
|
||||||
|
# Find latest tag matching vX.Y.Z
|
||||||
|
latest_tag=$(git tag --list 'v*.*.*' --sort=-v:refname | head -n 1)
|
||||||
|
if [[ -z "$latest_tag" ]]; then
|
||||||
|
major=0
|
||||||
|
minor=0
|
||||||
|
patch=0
|
||||||
|
else
|
||||||
|
version="${latest_tag#v}"
|
||||||
|
IFS='.' read -r major minor patch <<< "$version"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then
|
||||||
|
major=$((major + 1))
|
||||||
|
minor=0
|
||||||
|
patch=0
|
||||||
|
elif [[ "${GITHUB_REF}" == "refs/heads/development" ]]; then
|
||||||
|
minor=$((minor + 1))
|
||||||
|
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}"
|
||||||
|
echo "tag_name=${new_tag}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
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]
|
||||||
|
Reference in New Issue
Block a user