All checks were successful
Release Workflow / release (push) Successful in 7s
87 lines
2.9 KiB
YAML
87 lines
2.9 KiB
YAML
name: Release Workflow
|
|
on: [push]
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install zip
|
|
run: sudo apt-get install zip
|
|
|
|
- name: Configure Git
|
|
run: |
|
|
git config --global user.name "Git Admin"
|
|
git config --global user.email "gitadmin@quack-lab.dev"
|
|
|
|
- name: Run deploy script
|
|
run: bash deploy.sh
|
|
|
|
- name: Check for Existing Release Commit
|
|
id: check_release_commit
|
|
run: |
|
|
# Check if the latest commit is a release commit
|
|
if git log -1 --pretty=%B | grep -q "Release"; then
|
|
echo "Release commit found. Skipping version bump."
|
|
echo "::set-output name=release_commit::true"
|
|
else
|
|
echo "No release commit found. Proceeding with version bump."
|
|
echo "::set-output name=release_commit::false"
|
|
fi
|
|
|
|
- name: Run Release Script
|
|
if: steps.check_release_commit.outputs.release_commit == 'false'
|
|
run: bash release.sh
|
|
|
|
- name: Push Changes
|
|
if: steps.check_release_commit.outputs.release_commit == 'false'
|
|
run: |
|
|
git push origin HEAD:refs/heads/master --tags
|
|
|
|
- name: Determine Tag
|
|
id: determine_tag
|
|
run: |
|
|
# Check if the last commit has a tag
|
|
TAG=$(git describe --tags --exact-match 2>/dev/null || echo "")
|
|
if [ -z "$TAG" ]; then
|
|
# Get the latest tag
|
|
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
|
|
# Increment the minor version
|
|
IFS='.' read -r -a VERSION_PARTS <<< "$LATEST_TAG"
|
|
VERSION_PARTS[2]=$((VERSION_PARTS[2]+1))
|
|
TAG="${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.${VERSION_PARTS[2]}"
|
|
# Create a new tag
|
|
git tag $TAG
|
|
git push origin $TAG
|
|
fi
|
|
echo "::set-output name=tag::$TAG"
|
|
|
|
- name: Create Release
|
|
id: create_release
|
|
run: |
|
|
curl -X POST \
|
|
-H "Authorization: token ${{ secrets.JEBENI_TOKEN }}" \
|
|
-H "Accept: application/json" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"tag_name": "${{ steps.determine_tag.outputs.tag }}",
|
|
"name": "${{ steps.determine_tag.outputs.tag }}",
|
|
"draft": false,
|
|
"prerelease": false
|
|
}' \
|
|
http://srv-captain--git:3000/api/v1/repos/dave/wow-Heimdall/releases
|
|
|
|
- name: Upload Release Asset
|
|
run: |
|
|
RELEASE_ID=$(curl -s \
|
|
-H "Authorization: token ${{ secrets.JEBENI_TOKEN }}" \
|
|
http://srv-captain--git:3000/api/v1/repos/dave/wow-Heimdall/releases/tags/${{ steps.determine_tag.outputs.tag }} | jq -r '.id')
|
|
curl -X POST \
|
|
-H "Authorization: token ${{ secrets.JEBENI_TOKEN }}" \
|
|
-F "attachment=@Heimdall.zip" \
|
|
"http://srv-captain--git:3000/api/v1/repos/dave/wow-Heimdall/releases/${RELEASE_ID}/assets?name=Heimdall.zip"
|