Skip to content

chore(beta): release 2.0.0-beta.1 (#181) #51

chore(beta): release 2.0.0-beta.1 (#181)

chore(beta): release 2.0.0-beta.1 (#181) #51

on:
workflow_dispatch:
push:
branches:
- "beta"
env:
PLUGIN_NAME: calendarium
GH_BOT_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
GH_BOT_NAME: "GitHub Action"
permissions:
contents: write
pull-requests: write
name: Beta
jobs:
release:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
upload_url: ${{ steps.release.outputs.upload_url }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
config-file: release-please-config-beta.json
manifest-file: .release-please-manifest-beta.json
target-branch: beta
build:
runs-on: ubuntu-latest
needs: release
if: ${{ needs.release.outputs.release_created }}
env:
upload_url: ${{ needs.release.outputs.upload_url }}
tag_name: ${{ needs.release.outputs.tag_name }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "latest"
- name: Build
id: build
run: |
npm install
npm run build --if-present
mkdir ${{ env.PLUGIN_NAME }}
cp main.js manifest.json styles.css ${{ env.PLUGIN_NAME }}
zip -r ${{ env.PLUGIN_NAME }}.zip ${{ env.PLUGIN_NAME }}
- name: Upload Release Artifact
if: ${{ needs.release.outputs.release_created }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ needs.release.outputs.tag_name }} \
'./${{ env.PLUGIN_NAME }}.zip' \
'./main.js' \
'./styles.css' \
'./manifest.json'
beta:
runs-on: ubuntu-latest
needs: [build, release]
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: Update Beta Manifest
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name ${{ env.GH_BOT_NAME }}
git config user.email ${{ env.GH_BOT_EMAIL }}
sed 's|\(version":\) ".*"|\1 "'${{ needs.release.outputs.tag_name }}'"|' manifest.json > manifest-beta.json
cat manifest-beta.json
git add manifest-beta.json
git status
git status --porcelain
if [ -z "$(git status --porcelain)" ]; then
echo "🛑 Beta manifest already up-to-date"
exit 1
fi
git commit -m "🔖 ${{ needs.release.outputs.tag_name }}"
git push --force
notify:
runs-on: ubuntu-latest
needs: build
steps:
- name: Obsidian
uses: javalent/workflows/actions/discord-embed@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: Calendarium
webhook-urls: ${{ secrets.OBSIDIAN_WEBHOOK }}
beta: true
- name: TTRPG
uses: javalent/workflows/actions/discord-embed@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: Calendarium
webhook-urls: ${{ secrets.TTRPG_WEBHOOK }}
beta: true