refactor: clean up environment variable initialization in DuckStore n… #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .github/workflows/1-release.yml | |
name: Create Tag and Release | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- 'docs/**' | |
- '**.md' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
if: | | |
!contains(github.event.head_commit.message, 'no-release') && | |
!contains(github.event.head_commit.message, 'docker-only') && | |
!contains(github.event.head_commit.message, 'docs-only') | |
permissions: | |
contents: write | |
outputs: | |
new_tag: ${{ steps.tag_version.outputs.new_tag }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get latest tag | |
id: get_latest_tag | |
run: | | |
latest_tag=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "0.0.1") | |
echo "latest_tag=$latest_tag" >> $GITHUB_OUTPUT | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Bump version and update package.json | |
id: tag_version | |
run: | | |
latest_tag="${{ steps.get_latest_tag.outputs.latest_tag }}" | |
echo "Latest tag: $latest_tag" | |
IFS='.' read -r major minor patch <<< "$latest_tag" | |
new_version="$major.$minor.$((patch + 1))" | |
new_tag="v$new_version" | |
echo "New version: $new_version" | |
echo "New tag: $new_tag" | |
npm version $new_version --no-git-tag-version --allow-same-version | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add package.json package-lock.json | |
git commit -m "chore: bump version to ${new_tag}" | |
git push | |
git tag "$new_tag" | |
git push origin "$new_tag" | |
echo "new_tag=$new_tag" >> $GITHUB_OUTPUT | |
- name: Generate Release Notes | |
id: release_notes | |
run: | | |
previous_tag=$(git describe --tags --abbrev=0 HEAD^) | |
if [ -z "$previous_tag" ]; then | |
COMMITS="- Initial Release" | |
else | |
COMMITS=$(git log $previous_tag..HEAD --pretty=format:"- %s") | |
fi | |
echo "commits<<EOF" >> $GITHUB_OUTPUT | |
echo "$COMMITS" >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
- name: Create Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GHCR_PAT }} | |
with: | |
tag_name: ${{ steps.tag_version.outputs.new_tag }} | |
release_name: Release ${{ steps.tag_version.outputs.new_tag }} | |
body: | | |
# What's Changed | |
${{ steps.release_notes.outputs.commits }} | |
**Full Changelog**: https://github.com/${{ github.repository }}/commits/${{ steps.tag_version.outputs.new_tag }} | |
draft: false | |
prerelease: false |