dispatch-main #100
This file contains hidden or 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@v4 | |
| - 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 package.json | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: package.json | |
| key: ${{ github.event.client_payload.version }}-package.json | |
| enableCrossOsArchive: true | |
| build: | |
| needs: preprocessing | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| include: | |
| - os: ubuntu-latest | |
| arch: x64 | |
| - os: windows-latest | |
| arch: x64 | |
| - os: macos-latest | |
| arch: arm64 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| - name: Cache restore | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: package.json | |
| key: ${{ github.event.client_payload.version }}-package.json | |
| enableCrossOsArchive: 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 }} | |
| RUNNER_ARCH: ${{ matrix.arch }} | |
| - name: Upload dist artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: artifact-${{ runner.os }}-${{ matrix.arch }} | |
| path: | | |
| dist/* | |
| !dist/linux-unpacked/* | |
| !dist/win-unpacked/* | |
| !dist/win-ia32-unpacked/* | |
| !dist/mac/* | |
| !dist/mac-x64/* | |
| !dist/mac-arm64/* | |
| !dist/*.zip | |
| !dist/*.blockmap | |
| !dis/builder-debug.yml | |
| retention-days: 1 | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| id: download | |
| with: | |
| path: dist | |
| - name: Release to GitHub | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| ${{steps.download.outputs.download-path}}/artifact-*/*.AppImage | |
| ${{steps.download.outputs.download-path}}/artifact-*/*.exe | |
| ${{steps.download.outputs.download-path}}/artifact-*/*.dmg | |
| ${{steps.download.outputs.download-path}}/artifact-*/latest* | |
| name: Version ${{ github.event.client_payload.version }} | |
| tag_name: v${{ github.event.client_payload.version }} | |
| draft: true | |
| 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: ${{steps.download.outputs.download-path}}/artifact-Linux-x64/dbptk-desktop-${{ github.event.client_payload.version }}-linux-amd64.snap | |
| release: stable | |
| update: | |
| needs: deploy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set GitHub config | |
| run: | | |
| git config --local user.email "mguimaraes@keep.pt" | |
| 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 }} |