Skip to content

dispatch-main

dispatch-main #30

Workflow file for this run

name: Deploy
on:
repository_dispatch:
types: ["dispatch-main"]
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Update package.json
run: |
cat package.json | jq ".version = \"$RELEASE_VERSION\"" | jq ".dbvtkVersion = \"$RELEASE_VERSION\"" > tmp
mv tmp package.json
env:
RELEASE_VERSION: ${{ github.event.client_payload.version }}
- name: Cache dist
uses: actions/cache@v2
with:
path: dist/*
key: ${{ runner.os }}-${{ github.event.client_payload.version }}
- name: Package MacOS
if: startsWith(matrix.os, 'macos')
run: yarn --pure-lockfile && yarn dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DBPTK_UI_VERSION: ${{ github.event.client_payload.version }}
FLOW: ${{ github.event.client_payload.flow }}
RUNNER_OS: ${{ runner.os }}
- name: Package Linux & Windows
if: startsWith(matrix.os, 'ubuntu')
run: |
docker run --rm \
--env FLOW="${FLOW}" \
--env GITHUB_TOKEN="${GITHUB_TOKEN}" \
--env DBPTK_UI_VERSION="${DBPTK_UI_VERSION}" \
--env RUNNER_OS="${RUNNER_OS}" \
-v ${PWD}:/project \
-v ~/.cache/electron:/root/.cache/electron \
-v ~/.cache/electron-builder:/root/.cache/electron-builder \
electronuserland/builder:wine \
/bin/bash -c "apt-get update && apt-get install -y jq && yarn --link-duplicates --pure-lockfile && yarn dist-lw"
env:
DBPTK_UI_VERSION: ${{ github.event.client_payload.version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FLOW: ${{ github.event.client_payload.flow }}
RUNNER_OS: ${{ runner.os }}
- name: Set GitHub config
if: startsWith(matrix.os, 'ubuntu')
run: |
git config --local user.email "[email protected]"
git config --local user.name "Miguel Guimarães"
- name: Run release script
if: startsWith(matrix.os, 'ubuntu')
run: ./scripts/release.sh $TAG
env:
TAG: ${{ github.event.client_payload.version }}
- name: Push changes
if: startsWith(matrix.os, 'ubuntu')
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
deploy:
needs: [build]
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Cache dist
uses: actions/cache@v2
with:
path: dist/*
key: ${{ runner.os }}-${{ github.event.client_payload.version }}
- name: Release to GitHub
uses: softprops/action-gh-release@v1
with:
files: |
dist/dbptk-desktop-${{ github.event.client_payload.version }}.AppImage
dist/dbptk-desktop-${{ github.event.client_payload.version }}.exe
dist/dbptk-desktop-${{ github.event.client_payload.version }}.dmg
dist/latest*
name: Version ${{ github.event.client_payload.version }}
tag_name: v${{ github.event.client_payload.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to Snap
if: startsWith(matrix.os, 'ubuntu')
uses: snapcore/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_STORE_LOGIN }}
with:
snap: dist/dbptk-desktop-${{ github.event.client_payload.version }}.snap
release: stable