chore: update workflows
This commit is contained in:
@@ -1,8 +1,11 @@
|
|||||||
name: Publish
|
name: Publish
|
||||||
on:
|
on:
|
||||||
push:
|
workflow_call:
|
||||||
tags:
|
inputs:
|
||||||
- "v*"
|
version:
|
||||||
|
description: "The version tag to publish (e.g., v1.0.0)"
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
name: Publish to Go Module Proxy
|
name: Publish to Go Module Proxy
|
||||||
@@ -11,7 +14,7 @@ jobs:
|
|||||||
- name: Request module from proxy
|
- name: Request module from proxy
|
||||||
run: |
|
run: |
|
||||||
MODULE="github.com/StevanFreeborn/onspring-api-sdk-go"
|
MODULE="github.com/StevanFreeborn/onspring-api-sdk-go"
|
||||||
VERSION="${GITHUB_REF_NAME}"
|
VERSION="${{ inputs.version }}"
|
||||||
PROXY_URL="https://proxy.golang.org/${MODULE}/@v/${VERSION}.info"
|
PROXY_URL="https://proxy.golang.org/${MODULE}/@v/${VERSION}.info"
|
||||||
|
|
||||||
echo "Requesting: $PROXY_URL"
|
echo "Requesting: $PROXY_URL"
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ permissions:
|
|||||||
jobs:
|
jobs:
|
||||||
version:
|
version:
|
||||||
name: Version
|
name: Version
|
||||||
|
outputs:
|
||||||
|
new_tag: ${{ steps.bump.outputs.new_tag }}
|
||||||
|
skip: ${{ steps.bump.outputs.skip }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
@@ -21,12 +24,16 @@ jobs:
|
|||||||
LATEST_TAG=$(git tag -l 'v*' --sort=-v:refname | head -n 1)
|
LATEST_TAG=$(git tag -l 'v*' --sort=-v:refname | head -n 1)
|
||||||
|
|
||||||
if [ -z "$LATEST_TAG" ]; then
|
if [ -z "$LATEST_TAG" ]; then
|
||||||
LATEST_TAG="v0.0.0"
|
# No tags exist yet, create the initial v0.0.0 release
|
||||||
COMMITS=$(git log --pretty=format:"%s" --no-merges)
|
echo "No existing tags found. Creating initial v0.0.0 release."
|
||||||
else
|
echo "skip=false" >> "$GITHUB_OUTPUT"
|
||||||
COMMITS=$(git log "${LATEST_TAG}..HEAD" --pretty=format:"%s" --no-merges)
|
echo "new_tag=v0.0.0" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "initial=true" >> "$GITHUB_OUTPUT"
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
COMMITS=$(git log "${LATEST_TAG}..HEAD" --pretty=format:"%s" --no-merges)
|
||||||
|
|
||||||
echo "Latest tag: $LATEST_TAG"
|
echo "Latest tag: $LATEST_TAG"
|
||||||
echo "Commits since last tag:"
|
echo "Commits since last tag:"
|
||||||
echo "$COMMITS"
|
echo "$COMMITS"
|
||||||
@@ -76,20 +83,16 @@ jobs:
|
|||||||
echo "skip=false" >> "$GITHUB_OUTPUT"
|
echo "skip=false" >> "$GITHUB_OUTPUT"
|
||||||
echo "new_tag=$NEW_TAG" >> "$GITHUB_OUTPUT"
|
echo "new_tag=$NEW_TAG" >> "$GITHUB_OUTPUT"
|
||||||
echo "previous_tag=$LATEST_TAG" >> "$GITHUB_OUTPUT"
|
echo "previous_tag=$LATEST_TAG" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "initial=false" >> "$GITHUB_OUTPUT"
|
||||||
- name: Generate release notes
|
- name: Generate release notes
|
||||||
if: steps.bump.outputs.skip == 'false'
|
if: steps.bump.outputs.skip == 'false'
|
||||||
id: notes
|
|
||||||
run: |
|
run: |
|
||||||
PREVIOUS_TAG="${{ steps.bump.outputs.previous_tag }}"
|
if [ "${{ steps.bump.outputs.initial }}" = "true" ]; then
|
||||||
|
echo "Initial release" > release_notes.txt
|
||||||
if [ "$PREVIOUS_TAG" = "v0.0.0" ]; then
|
|
||||||
NOTES=$(git log --pretty=format:"- %s" --no-merges)
|
|
||||||
else
|
else
|
||||||
NOTES=$(git log "${PREVIOUS_TAG}..HEAD" --pretty=format:"- %s" --no-merges)
|
PREVIOUS_TAG="${{ steps.bump.outputs.previous_tag }}"
|
||||||
|
git log "${PREVIOUS_TAG}..HEAD" --pretty=format:"- %s" --no-merges > release_notes.txt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Write notes to a file to preserve newlines
|
|
||||||
echo "$NOTES" > release_notes.txt
|
|
||||||
- name: Create tag and release
|
- name: Create tag and release
|
||||||
if: steps.bump.outputs.skip == 'false'
|
if: steps.bump.outputs.skip == 'false'
|
||||||
env:
|
env:
|
||||||
@@ -103,3 +106,10 @@ jobs:
|
|||||||
gh release create "$NEW_TAG" \
|
gh release create "$NEW_TAG" \
|
||||||
--title "$NEW_TAG" \
|
--title "$NEW_TAG" \
|
||||||
--notes-file release_notes.txt
|
--notes-file release_notes.txt
|
||||||
|
publish:
|
||||||
|
name: Publish
|
||||||
|
needs: version
|
||||||
|
if: needs.version.outputs.skip != 'true'
|
||||||
|
uses: ./.github/workflows/publish.yml
|
||||||
|
with:
|
||||||
|
version: ${{ needs.version.outputs.new_tag }}
|
||||||
|
|||||||
Reference in New Issue
Block a user