This commit is contained in:
34
.github/workflows/release.yml
vendored
34
.github/workflows/release.yml
vendored
@@ -1,8 +1,5 @@
|
|||||||
name: Release Workflow
|
name: Release Workflow
|
||||||
on:
|
on: [push]
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- '[0-9]+.[0-9]+.[0-9]+'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
@@ -10,13 +7,33 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Install zip
|
- name: Install zip
|
||||||
run: sudo apt-get install zip
|
run: sudo apt-get install zip
|
||||||
|
|
||||||
- name: Run deploy script
|
- name: Run deploy script
|
||||||
run: bash deploy.sh
|
run: bash deploy.sh
|
||||||
|
|
||||||
|
- 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
|
- name: Create Release
|
||||||
id: create_release
|
id: create_release
|
||||||
run: |
|
run: |
|
||||||
@@ -25,8 +42,8 @@ jobs:
|
|||||||
-H "Accept: application/json" \
|
-H "Accept: application/json" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{
|
-d '{
|
||||||
"tag_name": "${{ github.ref_name }}",
|
"tag_name": "${{ steps.determine_tag.outputs.tag }}",
|
||||||
"name": "${{ github.ref_name }}",
|
"name": "${{ steps.determine_tag.outputs.tag }}",
|
||||||
"draft": false,
|
"draft": false,
|
||||||
"prerelease": false
|
"prerelease": false
|
||||||
}' \
|
}' \
|
||||||
@@ -36,8 +53,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
RELEASE_ID=$(curl -s \
|
RELEASE_ID=$(curl -s \
|
||||||
-H "Authorization: token ${{ secrets.JEBENI_TOKEN }}" \
|
-H "Authorization: token ${{ secrets.JEBENI_TOKEN }}" \
|
||||||
http://srv-captain--git:3000/api/v1/repos/dave/wow-Heimdall/releases/tags/${{ github.ref_name }} | jq -r '.id')
|
http://srv-captain--git:3000/api/v1/repos/dave/wow-Heimdall/releases/tags/${{ steps.determine_tag.outputs.tag }} | jq -r '.id')
|
||||||
|
|
||||||
curl -X POST \
|
curl -X POST \
|
||||||
-H "Authorization: token ${{ secrets.JEBENI_TOKEN }}" \
|
-H "Authorization: token ${{ secrets.JEBENI_TOKEN }}" \
|
||||||
-H "Content-Type: application/zip" \
|
-H "Content-Type: application/zip" \
|
||||||
|
Reference in New Issue
Block a user