Skip to content

Merge branch 'release/1.2.0' #12

Merge branch 'release/1.2.0'

Merge branch 'release/1.2.0' #12

Workflow file for this run

name: Release and Tag
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'Tag version (e.g., v1.0.0)'
required: true
type: string
jobs:
build-and-release:
runs-on: ubuntu-latest
name: Build and Create Release
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build action
run: npm run build
- name: Verify build
run: |
if [ ! -f "dist/index.js" ]; then
echo "❌ Build failed"
exit 1
fi
echo "✅ Build successful"
- name: Get tag version
id: tag
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
TAG_NAME="${{ inputs.tag }}"
else
TAG_NAME=${GITHUB_REF#refs/tags/}
fi
echo "tag=${TAG_NAME}" >> $GITHUB_OUTPUT
echo "version=${TAG_NAME#v}" >> $GITHUB_OUTPUT
- name: Create release archive
run: |
mkdir -p release-package
# Copy essential files for the release
cp -r dist/ release-package/
cp action.yml release-package/
cp README.md release-package/
cp package.json release-package/
# Create tarball
tar -czf gh-obs-helper-${{ steps.tag.outputs.tag }}.tar.gz -C release-package .
echo "📦 Release package created:"
ls -la gh-obs-helper-${{ steps.tag.outputs.tag }}.tar.gz
- name: Check for manual release notes
id: release_notes
run: |
if [ -f "RELEASE_NOTES.md" ]; then
echo "found=true" >> $GITHUB_OUTPUT
echo "✅ Using manual release notes from RELEASE_NOTES.md"
else
echo "found=false" >> $GITHUB_OUTPUT
echo "⚠️ No RELEASE_NOTES.md found, generating basic release notes"
# Generate basic release notes as fallback
echo "## 🚀 GH OBS Helper Release ${{ steps.tag.outputs.tag }}" > RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md
echo "### Release Information" >> RELEASE_NOTES.md
echo "This is an automated release of the GH OBS Helper." >> RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md
echo "### Available Operations" >> RELEASE_NOTES.md
echo "- upload: Upload files to OBS" >> RELEASE_NOTES.md
echo "- download: Download files from OBS" >> RELEASE_NOTES.md
echo "- sync: Synchronize local and OBS directories" >> RELEASE_NOTES.md
echo "- create-bucket: Create a new OBS bucket" >> RELEASE_NOTES.md
echo "- delete-bucket: Delete an OBS bucket" >> RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md
echo "### New Features" >> RELEASE_NOTES.md
echo "- Automatic URL generation for uploaded files" >> RELEASE_NOTES.md
echo "- Support for both public and private file URLs" >> RELEASE_NOTES.md
echo "- JSON array and convenience single URL outputs" >> RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md
echo "For detailed release notes, create a RELEASE_NOTES.md file before creating the release tag." >> RELEASE_NOTES.md
fi
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.tag }}
name: GH OBS Helper ${{ steps.tag.outputs.tag }}
body_path: RELEASE_NOTES.md
draft: false
prerelease: false
files: gh-obs-helper-${{ steps.tag.outputs.tag }}.tar.gz
generate_release_notes: false
- name: Update major version tag
run: |
MAJOR_VERSION=$(echo ${{ steps.tag.outputs.tag }} | sed 's/v\([0-9]*\).*/v\1/')
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
# Create or update major version tag (e.g., v1)
git tag -fa ${MAJOR_VERSION} -m "Update ${MAJOR_VERSION} to ${{ steps.tag.outputs.tag }}"
git push origin ${MAJOR_VERSION} --force