Release #71
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
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@v3 | |
- run: yarn | |
- uses: cycjimmy/semantic-release-action@8f6ceb9d5aae5578b1dcda6af00008235204e7fa | |
id: semantic | |
if: inputs.version == '' | |
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@v3 | |
- name: Install Node.js, NPM and Yarn | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 14.x | |
- name: Install Snapcraft | |
uses: samuelmeuli/action-snapcraft@06f69b882c878790b568f0247d623eaa49de2f3d | |
# 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 | |
- 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 }} |