Skip to content

Release

Release #119

name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Exsiting version to publish files. If not provided, will create a new release.'
required: false
type: string
push:
branches:
- master
paths-ignore:
- 'nuxt/**'
jobs:
release:
runs-on: ubuntu-latest
outputs:
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
steps:
- uses: actions/checkout@v4
# https://github.com/nodejs/node-gyp/issues/2869
- name: Use Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v4
with:
node-version: 16.x
cache: 'yarn'
cache-dependency-path: 'yarn.lock'
- run: yarn --network-timeout 100000
- uses: cycjimmy/semantic-release-action@cb425203a562475bca039ba4dbf90c7f9ac790f4
id: semantic
if: inputs.version == ''
with:
semantic_version: 19.0.5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish:
needs: [release]
if: needs.release.outputs.new_release_published == 'true' || inputs.version != ''
env:
NEW_RELEASE_PUBLISHED: ${{ inputs.version && 'true' || needs.release.outputs.new_release_published }}
NEW_RELEASE_VERSION: ${{ needs.release.outputs.new_release_version || inputs.version }}
strategy:
max-parallel: 3
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
# https://github.com/nodejs/node-gyp/issues/2869
- name: Use Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v4
with:
node-version: 16.x
cache: 'yarn'
cache-dependency-path: 'yarn.lock'
- name: Install Snapcraft
uses: samuelmeuli/action-snapcraft@d33c176a9b784876d966f80fb1b461808edc0641
# Only install Snapcraft on Ubuntu
if: startsWith(matrix.os, 'ubuntu')
continue-on-error: true
with:
# Log in to Snap Store
snapcraft_token: ${{ secrets.snapcraft_token }}
- name: set version
run: yarn version --no-git-tag-version --new-version ${{ env.NEW_RELEASE_VERSION }}
- run: yarn --network-timeout 100000
- name: Build & release Electron app
shell: bash
env:
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: --max-old-space-size=4096
SEGMENT_WRITE_KEY: ${{ secrets.SEGMENT_WRITE_KEY }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
PUBLISH_PARAM: ${{ env.NEW_RELEASE_PUBLISHED == 'true' && 'always' || 'never' }}
run: |
yarn build --publish $PUBLISH_PARAM
notify:
needs: [release, publish]
if: needs.release.outputs.new_release_published == 'true' || inputs.version != ''
env:
NEW_RELEASE_PUBLISHED: ${{ inputs.version && 'true' || needs.release.outputs.new_release_published }}
NEW_RELEASE_VERSION: ${{ needs.release.outputs.new_release_version || inputs.version }}
runs-on: ubuntu-latest
steps:
- name: notify Discord
if: env.NEW_RELEASE_PUBLISHED == 'true'
env:
msg: 'Yay! 🎉 \n Version ${{ env.NEW_RELEASE_VERSION }} was released! \n Check it out in: https://github.com/brafdlog/caspion/releases/tag/v${{ env.NEW_RELEASE_VERSION }}'
run: |
curl -X POST -H "Content-Type: application/json" -d "{\"content\": \"$msg\"}" ${{ secrets.DISCORD_WEBHOOK }}