-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added automated webworker release action
- Loading branch information
1 parent
302e5ee
commit 5c3947f
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
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
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 |