Refactor analytics: Remove GA code, update onboarding key. (#3) #3
This file contains hidden or 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
| name: Create Release | |
| on: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| create-release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get previous version | |
| id: previous_version | |
| run: | | |
| # Find the last commit that modified manifest.json | |
| LAST_VERSION_COMMIT=$(git log -1 --format=%H -- manifest.json) | |
| if [ -z "$LAST_VERSION_COMMIT" ]; then | |
| echo "No previous version found" | |
| echo "previous_version=none" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| # Get the version from that commit | |
| PREV_VERSION=$(git show $LAST_VERSION_COMMIT:manifest.json | jq -r .version) | |
| if [ -z "$PREV_VERSION" ]; then | |
| echo "Failed to extract previous version" | |
| exit 1 | |
| fi | |
| echo "previous_version=$PREV_VERSION" >> $GITHUB_OUTPUT | |
| - name: Get current version | |
| id: current_version | |
| run: | | |
| CURRENT_VERSION=$(cat manifest.json | jq -r .version) | |
| if [ -z "$CURRENT_VERSION" ]; then | |
| echo "Failed to extract current version" | |
| exit 1 | |
| fi | |
| echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT | |
| - name: Generate Release Notes | |
| if: steps.previous_version.outputs.previous_version != steps.current_version.outputs.current_version | |
| id: release_notes | |
| run: | | |
| # Get commit messages between previous and current version | |
| COMMITS=$(git log --pretty=format:"* %s (%h)" HEAD^..HEAD | grep -v "chore: bump version" | grep -v "chore: release") | |
| # Create release notes with version and commit messages | |
| echo "release_notes<<EOF" >> $GITHUB_OUTPUT | |
| echo "## What's New in v${{ steps.current_version.outputs.current_version }}" >> $GITHUB_OUTPUT | |
| echo "" >> $GITHUB_OUTPUT | |
| echo "### Changes" >> $GITHUB_OUTPUT | |
| echo "$COMMITS" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| if: steps.previous_version.outputs.previous_version != steps.current_version.outputs.current_version | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: v${{ steps.current_version.outputs.current_version }} | |
| release_name: Release v${{ steps.current_version.outputs.current_version }} | |
| body: ${{ steps.release_notes.outputs.release_notes }} | |
| draft: false | |
| prerelease: false | |
| - name: Upload Release Asset | |
| if: steps.previous_version.outputs.previous_version != steps.current_version.outputs.current_version | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./manifest.json | |
| asset_name: manifest.json | |
| asset_content_type: application/json | |
| - name: Create Extension Zip | |
| if: steps.previous_version.outputs.previous_version != steps.current_version.outputs.current_version | |
| run: | | |
| chmod +x create-release-zip.sh | |
| ./create-release-zip.sh || exit 1 | |
| - name: Upload Extension Zip | |
| if: steps.previous_version.outputs.previous_version != steps.current_version.outputs.current_version | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./extension.zip | |
| asset_name: ValueTime-v${{ steps.current_version.outputs.current_version }}.zip | |
| asset_content_type: application/zip | |
| - name: Cleanup | |
| if: always() | |
| run: | | |
| rm -f extension.zip |