daledesilva_obsidian_projec.../.github/workflows/draft-beta-release.yml
2026-06-15 23:30:46 +10:00

121 lines
4.1 KiB
YAML

name: Draft beta release
run-name: Beta Release by @${{ github.actor }} - ${{ github.event.head_commit.message }}
# TO DRAFT THIS RELEASE
# 1. Update manifest-beta.json version if necessary
# 2. npm run beta-release <version-tag>
# ---
# Notes:
# Solution to checking current branch when initialised via tag taken from here:
# https://stackoverflow.com/questions/63745613/how-to-get-a-branch-name-on-github-action-when-push-on-a-tag
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+-beta' # Matches semantic versions like 1.2.3-beta
- '[0-9]+.[0-9]+.[0-9]+.[0-9]+-beta' # Matches semantic versions like 1.2.3.4-beta
jobs:
draft-beta-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: 'npm'
# Build the plugin
- name: Build
id: build
run: |
npm ci
npm run build --if-present
# Package the required files into a zip
# Using manifest-beta.json in place of manifest.json
- name: Package
run: |
mkdir ${{ github.event.repository.name }}
cp ./dist/manifest-beta.json ${{ github.event.repository.name }}/manifest.json
cp ./dist/main.js ${{ github.event.repository.name }}
cp ./dist/styles.css ${{ github.event.repository.name }}
cp README.md ${{ github.event.repository.name }}
zip -r ${{ github.event.repository.name }}.zip ${{ github.event.repository.name }}
# Create the release on github
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: ${{ github.ref_name }}
body: |
This is a **beta pre-release** and can only be installed manually or through the BRAT plugin. [See beta installations here](https://github.com/daledesilva/obsidian_project-browser?tab=readme-ov-file#-installation).
### Added this update:
### Broken this update:
▶️ **Watch the [release video]().**
draft: true
prerelease: true
# Upload the packaged release file
- name: Upload zip file
id: upload-zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ github.event.repository.name }}.zip
asset_name: ${{ github.event.repository.name }}.zip
asset_content_type: application/zip
# Upload the main.js
- name: Upload main.js
id: upload-main
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.event.repository.name }}/main.js
asset_name: main.js
asset_content_type: text/javascript
# Upload the manifest.json
- name: Upload manifest.json
id: upload-manifest
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.event.repository.name }}/manifest.json
asset_name: manifest.json
asset_content_type: application/json
# Upload the style.css
- name: Upload styles.css
id: upload-css
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.event.repository.name }}/styles.css
asset_name: styles.css
asset_content_type: text/css