Skip to content

Commit

Permalink
added automated webworker release action
Browse files Browse the repository at this point in the history
  • Loading branch information
stevensJourney committed Feb 15, 2024
1 parent 302e5ee commit 5c3947f
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# This triggers whenever a tagged release is pushed
name: Compile Assets and Create Draft Release

on:
push:
tags:
- 'v*' # Trigger on tags beginning with 'v'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Install Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.x'
channel: 'stable'

- name: Install Melos
run: flutter pub global activate melos

- name: Install dependencies and compile assets
run: melos prepare

# Extract the tag name from the event payload
- name: Get Tag Name
id: get_tag_name
run: echo ::set-output name=tag_name::${GITHUB_REF/refs\/tags\//}

# Determine if the release should be a prerelease (true if the version contains "-")
- name: Determine Prerelease
id: determine_prerelease
run: echo ::set-output name=is_prerelease::$(echo ${{ steps.get_tag_name.outputs.tag_name }} | grep -q "-" && echo "true" || echo "false")

# Create the Draft release using the tag name
- name: Create Draft Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_tag_name.outputs.tag_name }} # Use the pushed tag name
release_name: Release ${{ steps.get_tag_name.outputs.tag_name }}
draft: true
prerelease: ${{ steps.determine_prerelease.outputs.is_prerelease }}

# Upload the compiled assets to the Draft release.
- name: Upload Assets to Draft Release
id: 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: ./assets/powersync_db.worker.js
asset_name: powersync_db.worker.js
asset_content_type: text/javascript

0 comments on commit 5c3947f

Please sign in to comment.