From 5107c87aea01ca01fd35d8c478e678356934bcd7 Mon Sep 17 00:00:00 2001 From: MARCROCK22 Date: Wed, 16 Apr 2025 17:24:13 -0400 Subject: [PATCH] chore: test --- .github/workflows/releases.yml | 76 ++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/releases.yml diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml new file mode 100644 index 0000000..a73781b5 --- /dev/null +++ b/.github/workflows/releases.yml @@ -0,0 +1,76 @@ +name: Create Release + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Fetch tags + run: git fetch --tags + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '23' + + - name: Install dependencies + run: npm install + + - name: Build project + run: npm run build + + - name: Get version from package.json + id: get_version + run: echo "::set-output name=version::$(node -p "require('./package.json').version")" + + - name: Set repository variable + run: echo "REPO=${{ github.repository }}" >> $GITHUB_ENV + + - name: Get and format commits + run: | + last_tag=$(git tag --sort=-v:refname | head -n 1) + if [ -z "$last_tag" ]; then + git log --pretty=format:"%h - %s" > commits.txt + else + git log ${last_tag}..HEAD --pretty=format:"%h - %s" > commits.txt + fi + sed -e "s|^\([a-f0-9]\+\) - \(.*\)|- [\1](https://github.com/$REPO/commit/\1) - \2|" commits.txt > formatted_commits.txt + echo "Changes in this release:" > release_body.txt + cat formatted_commits.txt >> release_body.txt + + - name: Create tag + run: | + git tag v${{ steps.get_version.outputs.version }} + git push origin v${{ steps.get_version.outputs.version }} + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ steps.get_version.outputs.version }} + release_name: Release v${{ steps.get_version.outputs.version }} + body_path: release_body.txt + draft: false + prerelease: false + + - name: Zip dist folder + run: zip -r dist.zip dist + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./dist.zip + asset_name: dist.zip + asset_content_type: application/zip \ No newline at end of file