From 84fd234abb8a16da9877cd23c573945041295032 Mon Sep 17 00:00:00 2001 From: Kyle McDonald Date: Fri, 20 Jun 2025 15:53:47 -0700 Subject: [PATCH] actions --- .github/workflows/release-advanced.yml | 69 ++++++++++++++++++++++++++ .github/workflows/release.yml | 39 +++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 .github/workflows/release-advanced.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release-advanced.yml b/.github/workflows/release-advanced.yml new file mode 100644 index 0000000..a6699f1 --- /dev/null +++ b/.github/workflows/release-advanced.yml @@ -0,0 +1,69 @@ +name: Advanced Release + +on: + push: + tags: + - 'v*' + +jobs: + build-and-release: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Required for changelog generation + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Build project + run: npm run build + + - name: Create release zip + run: | + cd dist + zip -r ../release.zip . + + - name: Generate changelog + id: changelog + run: | + # Get the previous tag + PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD~1 2>/dev/null || echo "") + + if [ -z "$PREVIOUS_TAG" ]; then + # If no previous tag, get all commits + CHANGELOG=$(git log --oneline --no-merges) + else + # Get commits since the previous tag + CHANGELOG=$(git log --oneline --no-merges ${PREVIOUS_TAG}..HEAD) + fi + + echo "changelog<> $GITHUB_OUTPUT + echo "$CHANGELOG" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + files: release.zip + body: | + ## Changes in this release: + + ``` + ${{ steps.changelog.outputs.changelog }} + ``` + + ## Installation + 1. Download the `release.zip` file + 2. Extract the contents + 3. Open `index.html` in your browser + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..44b54fb --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +name: Create Release + +on: + push: + tags: + - 'v*' # Trigger on version tags like v1.0.0, v2.1.3, etc. + +jobs: + build-and-release: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Build project + run: npm run build + + - name: Create release zip + run: | + cd dist + zip -r ../release.zip . + + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + files: release.zip + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file