dispatch-main #32
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: Deploy | |
on: | |
repository_dispatch: | |
types: ["dispatch-main"] | |
jobs: | |
preprocessing: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- 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/save@v3 | |
with: | |
path: package.json | |
key: ${{ runner.os }}-${{ github.event.client_payload.version }}-package.json | |
build: | |
needs: preprocessing | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20.x' | |
- name: Cache restore | |
uses: actions/cache/restore@v3 | |
with: | |
path: package.json | |
key: ${{ runner.os }}-${{ github.event.client_payload.version }}-package.json | |
fail-on-cache-miss: true | |
- name: Package | |
run: yarn --link-duplicates --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: Cache restore | |
uses: actions/cache/save@v3 | |
with: | |
path: dist/* | |
key: ${{ runner.os }}-${{ github.event.client_payload.version }} | |
deploy: | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cache dist | |
uses: actions/cache@v3 | |
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 | |
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 | |
update: | |
needs: deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set GitHub config | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "Miguel Guimarães" | |
- name: Run release script | |
run: ./scripts/release.sh $TAG | |
env: | |
TAG: ${{ github.event.client_payload.version }} | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} |