diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ed202cad..41f40792 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,22 +7,55 @@ on: concurrency: group: ${{ github.ref }} cancel-in-progress: true +env: + EMAIL: don.cryptus@gmail.com + ARCH: x86_64 jobs: + setup: + runs-on: ubuntu-latest + outputs: + arch: ${{ env.ARCH }} + email: ${{ env.EMAIL }} + name: ${{ steps.get-package.outputs.name }} + name-bin: ${{ steps.get-package.outputs.name }}-bin + version: ${{ steps.get-package.outputs.version }} + description: ${{ steps.get-package.outputs.description }} + license: ${{ steps.get-package.outputs.license }} + deb-pkg-name: ${{ steps.get-package.outputs.name }}_${{ steps.get-package.outputs.version }}_amd64.deb + deb-pkg-path: ./src-tauri/target/release/bundle/deb/ + steps: + - uses: actions/checkout@v3 + - name: setup node + uses: actions/setup-node@v3 + with: + node-version: 20 + - name: get package info + id: get-package + run: | + echo "name=$(node -p "require('./package.json').name")" >> $GITHUB_OUTPUT + echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT + echo "description=$(node -p "require('./package.json').description")" >> $GITHUB_OUTPUT + - uses: dev-drprasad/delete-tag-and-release@v1.0 + with: + tag_name: ${{ steps.get-package.outputs.version }} + github_token: ${{ secrets.GITHUB_TOKEN }} + create-release: + needs: setup permissions: contents: write runs-on: ubuntu-latest outputs: release_id: ${{ steps.create-release.outputs.result }} - + env: + PACKAGE_VERSION: ${{ needs.setup.outputs.version }} + PACKAGE_NAME: ${{ needs.setup.outputs.name }} steps: - uses: actions/checkout@v3 - name: setup node uses: actions/setup-node@v3 with: - node-version: 18 - - name: get version - run: echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV + node-version: 20 - name: create release id: create-release uses: actions/github-script@v6 @@ -31,8 +64,8 @@ jobs: const { data } = await github.rest.repos.createRelease({ owner: context.repo.owner, repo: context.repo.repo, - tag_name: `clippy-v${process.env.PACKAGE_VERSION}`, - name: `Clippy v${process.env.PACKAGE_VERSION}`, + tag_name: `${{ env.PACKAGE_VERSION }}`, + name: `${{ env.PACKAGE_NAME }} v${{ env.PACKAGE_VERSION }}`, body: 'Take a look at the assets to download and install this app.', draft: true, prerelease: false @@ -40,38 +73,161 @@ jobs: return data.id build-tauri: - needs: create-release + needs: [setup, create-release] permissions: contents: write strategy: fail-fast: false matrix: platform: [macos-latest, ubuntu-latest, windows-latest] - runs-on: ${{ matrix.platform }} + env: + BIN_PATH: ${{ needs.setup.outputs.name-bin }} + DESCRIPTION: ${{ needs.setup.outputs.description }} + LICENSE: ${{ needs.setup.outputs.license }} + DEB_PKG_NAME: ${{ needs.setup.outputs.deb-pkg-name }} + DEB_PKG_PATH: ${{ needs.setup.outputs.deb-pkg-path }} + DEB_PKG_RENAMED: ${{ needs.setup.outputs.name }}-${{ needs.setup.outputs.version }}-${{ needs.setup.outputs.arch }}.deb # leave as is it needs to be renamed for the arch build + ARCH_PKG_NAME: ${{ needs.setup.outputs.name-bin }}-${{ needs.setup.outputs.version }}-1-${{ needs.setup.outputs.arch }}.pkg.tar.zst + RPM_PKG_NAME: ${{ needs.setup.outputs.name }}-${{ needs.setup.outputs.version }}-1.${{ needs.setup.outputs.arch }}.rpm + PACKAGE_VERSION: ${{ needs.setup.outputs.version }} + PACKAGE_NAME: ${{ needs.setup.outputs.name }} steps: + - uses: actions/checkout@v3 + - name: setup node uses: actions/setup-node@v3 with: - node-version: 18 - - name: install Rust stable + node-version: 20 + + - name: install rust stable uses: dtolnay/rust-toolchain@stable + - name: install dependencies (ubuntu only) if: matrix.platform == 'ubuntu-latest' run: | sudo apt-get update wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb - sudo apt-get install -y openssl libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf libxcb-shape0-dev libxcb-xfixes0-dev libxdo-dev + sudo apt-get install -y openssl sudo make alien libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf libxcb-shape0-dev libxcb-xfixes0-dev libxdo-dev + - name: install frontend dependencies run: yarn install + - uses: tauri-apps/tauri-action@v0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: releaseId: ${{ needs.create-release.outputs.release_id }} + - name: upload deb (ubuntu only) + if: matrix.platform == 'ubuntu-latest' + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ env.DEB_PKG_PATH }}${{ env.DEB_PKG_NAME }} + asset_name: ${{ env.DEB_PKG_NAME }} + tag: ${{ env.PACKAGE_VERSION }} + overwrite: true + + - name: copy deb package && create PKGBUILD (ubuntu only) + if: matrix.platform == 'ubuntu-latest' + run: | + mkdir ${{ env.BIN_PATH }} + cp -fr ${{ env.DEB_PKG_PATH }}${{ env.DEB_PKG_NAME }} ${{ env.BIN_PATH }}/${{ env.DEB_PKG_RENAMED }} + cat < ./${{ env.BIN_PATH }}/PKGBUILD + # Maintainer: ${{ github.repository_owner }} <${{ env.EMAIL }}> + # Contributor: ${{ github.repository_owner }} <${{ env.EMAIL }}> + _packager="${{ github.repository_owner }} <${{ env.EMAIL }}>" + _deb_pkgname=${{ env.PACKAGE_NAME }} + pkgname=${{ env.BIN_PATH }} + pkgver=${{ env.PACKAGE_VERSION }} + md5sums=('$(md5sum ${{ env.BIN_PATH }}/${{ env.DEB_PKG_RENAMED }} | awk '{print $1}')') + pkgrel=1 + pkgdesc='${{ env.DESCRIPTION }}' + arch=('${{ env.ARCH }}') + url="https://github.com/${{ github.repository }}" + license=('${{ env.LICENSE }}') + source=("\$url/releases/download/${{ env.PACKAGE_VERSION }}/${{ env.DEB_PKG_RENAMED }}") + + build() { + rm control.tar.gz + tar xvf data.tar.gz + } + + package() { + cp -fr usr/ \${pkgdir} + } + EOF + cat ${{ env.BIN_PATH }}/PKGBUILD + ls -la ${{ env.BIN_PATH }} + + - name: create arch package (ubuntu only) + if: matrix.platform == 'ubuntu-latest' + uses: 2m/arch-pkgbuild-builder@v1.17 + with: + debug: true + target: pkgbuild + pkgname: ${{ env.BIN_PATH }}/ + + - name: create rpm package (ubuntu only) + if: matrix.platform == 'ubuntu-latest' + run: | + sudo apt-get update && sudo apt-get install -y sudo make alien + alien -r -k --scripts --target=x86_64 ${{ env.DEB_PKG_PATH }}${{ env.DEB_PKG_NAME }} + + - name: create checksums (ubuntu only) + if: matrix.platform == 'ubuntu-latest' + run: | + md5sum ${{ env.BIN_PATH }}/${{ env.ARCH_PKG_NAME}} > ${{ env.BIN_PATH }}/${{ env.ARCH_PKG_NAME }}.md5sum + md5sum ${{ env.DEB_PKG_PATH }}${{ env.DEB_PKG_NAME }} > ${{ env.DEB_PKG_NAME }}.md5sum + md5sum ${{ env.RPM_PKG_NAME }} > ${{ env.RPM_PKG_NAME }}.md5sum + + - name: upload arch (ubuntu only) + if: matrix.platform == 'ubuntu-latest' + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ env.BIN_PATH }}/${{ env.ARCH_PKG_NAME }} + asset_name: ${{ env.ARCH_PKG_NAME }} + tag: ${{ env.PACKAGE_VERSION }} + overwrite: true + + # - name: upload deb (ubuntu only) + # if: matrix.platform == 'ubuntu-latest' + # uses: svenstaro/upload-release-action@v2 + # with: + # repo_token: ${{ secrets.GITHUB_TOKEN }} + # file: ${{ env.DEB_PKG_PATH }}${{ env.DEB_PKG_NAME }} + # asset_name: ${{ env.DEB_PKG_NAME }} + # tag: ${{ env.PACKAGE_VERSION }} + # overwrite: true + + - name: upload rpm (ubuntu only) + if: matrix.platform == 'ubuntu-latest' + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ env.RPM_PKG_NAME }} + asset_name: ${{ env.RPM_PKG_NAME }} + tag: ${{ env.PACKAGE_VERSION }} + overwrite: true + + # - name: upload arch && rpm release (ubuntu only) + # if: matrix.platform == 'ubuntu-latest' + # uses: softprops/action-gh-release@v1 + # with: + # token: ${{ secrets.GITHUB_TOKEN }} + # tag_name: ${{ env.PACKAGE_VERSION }} + # files: | + # ${{ env.BIN_PATH }}/${{ env.ARCH_PKG_NAME }} + # ${{ env.BIN_PATH }}/${{ env.ARCH_PKG_NAME }}.md5sum + # ${{ env.DEB_PKG_PATH }}${{ env.DEB_PKG_NAME }} + # ${{ env.DEB_PKG_NAME }}.md5sum + # ${{ env.RPM_PKG_NAME }} + # ${{ env.RPM_PKG_NAME }}.md5sum + publish-release: permissions: contents: write diff --git a/package.json b/package.json index 5e7aff0d..cfcec505 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,8 @@ { "name": "clippy", - "version": "1.2.0", + "version": "1.2.1", + "description": "Clipboard Manager built with Rust & Typescript", + "license": "MIT", "private": true, "scripts": { "start": "vite", @@ -43,4 +45,4 @@ "vite-plugin-checker": "^0.6.2", "vite-plugin-solid": "^2.7.2" } -} +} \ No newline at end of file diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 730a5bf0..072be6ac 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -879,7 +879,7 @@ dependencies = [ [[package]] name = "clippy" -version = "1.2.0" +version = "1.2.1" dependencies = [ "arboard", "base64 0.13.1", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index b1996307..ca108752 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "clippy" -version = "1.2.0" +version = "1.2.1" description = "Clipboard Manager built with Rust & Typescript" authors = ["Don-Cryptus"] license = "MIT" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index b6ef82bd..ef80df82 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "clippy", - "version": "1.2.0" + "version": "1.2.1" }, "tauri": { "allowlist": {