Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,85 @@ jobs:
files: go/coverage.out
flags: go
fail_ci_if_error: false

publishRelease:
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [test, findChangedGoFiles]
if: ${{ needs.findChangedGoFiles.outputs.isGoFilesChanged == 'true' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v6
with:
submodules: true
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: '1.21'
- name: Extract version from go.mod
id: version-extract
run: |
# For Go modules, version is typically managed through git tags
# We'll read the module path and create a version based on semantic versioning
MODULE_PATH=$(grep "^module " go.mod | awk '{print $2}')
echo "module_path=$MODULE_PATH" >> $GITHUB_OUTPUT

# Get the latest tag for Go module (if any)
LATEST_TAG=$(git describe --tags --match "go_*" --abbrev=0 2>/dev/null || echo "")
if [ -z "$LATEST_TAG" ]; then
# If no tag exists, use version 0.13.0 to match other packages
PACKAGE_VERSION="0.13.0"
else
# Extract version from tag (format: go_X.Y.Z)
PACKAGE_VERSION="${LATEST_TAG#go_}"
fi

echo "version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
echo "Go module: $MODULE_PATH"
echo "Version: $PACKAGE_VERSION"
- name: Check if GitHub release already exists
id: release-check
run: |
PACKAGE_VERSION="${{ steps.version-extract.outputs.version }}"
TAG_NAME="go_$PACKAGE_VERSION"
echo "Checking if release $TAG_NAME already exists"

# Check if release exists
if gh release view "$TAG_NAME" >/dev/null 2>&1; then
echo "Release $TAG_NAME already exists"
echo "should_create_release=false" >> $GITHUB_OUTPUT
else
echo "Release $TAG_NAME does not exist"
echo "should_create_release=true" >> $GITHUB_OUTPUT
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub release and tag
if: steps.release-check.outputs.should_create_release == 'true'
run: |
PACKAGE_VERSION="${{ steps.version-extract.outputs.version }}"
MODULE_PATH="${{ steps.version-extract.outputs.module_path }}"
TAG_NAME="go_${PACKAGE_VERSION}"

# Create and push tag
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "$TAG_NAME" -m "Go module release $PACKAGE_VERSION"
git push origin "$TAG_NAME"

# Create GitHub release
gh release create "$TAG_NAME" \
--title "[Go] $PACKAGE_VERSION" \
--notes "Go module release for \`$MODULE_PATH\`

## Installation

\`\`\`bash
go get $MODULE_PATH@$TAG_NAME
\`\`\`

## Documentation

https://pkg.go.dev/$MODULE_PATH@$TAG_NAME"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 4 additions & 2 deletions .github/workflows/java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,10 @@ jobs:
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Import GPG key
run: |
echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
- name: Check if version already published
id: version-check
run: |
Expand Down
2 changes: 1 addition & 1 deletion java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.github.link-foundation</groupId>
<artifactId>links-notation</artifactId>
<version>0.1.0</version>
<version>0.13.0</version>
<packaging>jar</packaging>

<name>Links Notation</name>
Expand Down
Loading