diff --git a/.github/workflows/build-workflow.yml b/.github/workflows/build-workflow.yml new file mode 100644 index 0000000..04b4eca --- /dev/null +++ b/.github/workflows/build-workflow.yml @@ -0,0 +1,129 @@ +name: Build pakkit + +on: push + +jobs: + build-job: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up Node + uses: actions/setup-node@v1 + with: + node-version: 12.x + + - name: Set up Java + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + - name: Install Wine + run: sudo apt install wine64 + + - name: Install node-prune + run: curl -sf https://gobinaries.com/tj/node-prune | sh + + - run: npm install + + - name: Build for Windows + run: | + npx electron-forge package --platform win32 + cd out/pakkit-win32-x64/resources/app/; node-prune; npx electron-rebuild -v 8.5.2 + + - name: Build for Linux + run: | + npx electron-forge package --platform linux + cd out/pakkit-linux-x64/resources/app/; node-prune; npx electron-rebuild -v 8.5.2; + + - run: chmod +x out/pakkit-linux-x64/pakkit + + - name: Build for macOS + run: | + npx electron-forge package --platform darwin + cd out/pakkit-darwin-x64/pakkit.app/Contents/Resources/app/; node-prune; npx electron-rebuild -v 8.5.2 + + - name: Create archives for new release + if: ${{ github.ref == 'refs/heads/master' }} + run: | + mv out/pakkit-win32-x64 pakkit-windows-x64 + mv out/pakkit-linux-x64 pakkit-linux-x64 + mv out/pakkit-darwin-x64 pakkit-macos-x64 + zip -r -y out/pakkit-windows-x64.zip pakkit-windows-x64/ + zip -r -y out/pakkit-linux-x64.zip pakkit-linux-x64/ + zip -r -y out/pakkit-macos-x64.zip pakkit-macos-x64/ + + - name: Create release + id: create_release + uses: actions/create-release@v1 + if: ${{ github.ref == 'refs/heads/master' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: github-${{ github.run_number }} + release_name: GitHub build ${{ github.run_number }} + body: github-${{ github.run_number }} + + - name: Upload Windows build + uses: actions/upload-release-asset@v1 + if: ${{ github.ref == 'refs/heads/master' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: out/pakkit-windows-x64.zip + asset_name: pakkit-windows-x64.zip + asset_content_type: application/zip + + - name: Upload Linux build + uses: actions/upload-release-asset@v1 + if: ${{ github.ref == 'refs/heads/master' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: out/pakkit-linux-x64.zip + asset_name: pakkit-linux-x64.zip + asset_content_type: application/zip + + - name: Upload macOS build + uses: actions/upload-release-asset@v1 + if: ${{ github.ref == 'refs/heads/master' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: out/pakkit-macos-x64.zip + asset_name: pakkit-macos-x64.zip + asset_content_type: application/zip + + - name: Prepare to upload artifacts + if: ${{ github.ref != 'refs/heads/master' }} + run: | + mkdir out/windows + mkdir out/linux + mkdir out/macos + mv out/pakkit-win32-x64 out/windows/pakkit-windows-x64 + mv out/pakkit-linux-x64 out/linux/pakkit-linux-x64 + mv out/pakkit-darwin-x64 out/macos/pakkit-macos-x64 + + - name: Upload Windows artifact + uses: actions/upload-artifact@v2 + if: ${{ github.ref != 'refs/heads/master' }} + with: + name: pakkit-windows-x64 + path: out/windows/ + + - name: Upload Linux artifact + uses: actions/upload-artifact@v2 + if: ${{ github.ref != 'refs/heads/master' }} + with: + name: pakkit-linux-x64 + path: out/linux/ + + - name: Upload macOS artifact + uses: actions/upload-artifact@v2 + if: ${{ github.ref != 'refs/heads/master' }} + with: + name: pakkit-macos-x64 + path: out/macos/ diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index dfcf124..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,51 +0,0 @@ -pipeline { - agent any - tools { - nodejs 'Node 12' - jdk 'Java 8' - } - stages { - stage('build') { - steps { - sh 'git submodule init' - sh 'git submodule update' - sh 'npm install' - sh 'npx electron-forge package --platform win32' - sh 'cd out/pakkit-win32-x64/resources/app/; node-prune; npx electron-rebuild -v 8.5.2' - sh 'npx electron-forge package --platform linux' - sh 'cd out/pakkit-linux-x64/resources/app/; node-prune; npx electron-rebuild -v 8.5.2;' - sh 'chmod +x out/pakkit-linux-x64/pakkit' - sh 'npx electron-forge package --platform darwin' - sh 'cd out/pakkit-darwin-x64/pakkit.app/Contents/Resources/app/; node-prune; npx electron-rebuild -v 8.5.2' - sh 'mv out/pakkit-win32-x64 pakkit-windows-x64' - sh 'mv out/pakkit-linux-x64 pakkit-linux-x64' - sh 'mv out/pakkit-darwin-x64 pakkit-macos-x64' - sh 'zip -r -y out/pakkit-windows-x64.zip pakkit-windows-x64/' - sh 'zip -r -y out/pakkit-linux-x64.zip pakkit-linux-x64/' - sh 'zip -r -y out/pakkit-macos-x64.zip pakkit-macos-x64/' - } - post { - success { - archiveArtifacts artifacts: '**/out/*.zip', fingerprint: true - script { - if (env.BRANCH_NAME == 'master') { - withCredentials([usernamePassword(credentialsId: 'GitHubPAToken', usernameVariable: 'USERNAME', passwordVariable: 'GITHUB_TOKEN')]) { - sh 'echo "Creating a new release in github"' - sh 'github-release release --user Heath123 --repo pakkit --tag v${BUILD_NUMBER} --name "Jenkins build ${BUILD_NUMBER}"' - sh 'echo "Uploading the artifacts into github"' - sh 'github-release upload --user Heath123 --repo pakkit --tag v${BUILD_NUMBER} --name "pakkit-windows-x64.zip" --file out/pakkit-windows-x64.zip' - sh 'github-release upload --user Heath123 --repo pakkit --tag v${BUILD_NUMBER} --name "pakkit-linux-x64.zip" --file out/pakkit-linux-x64.zip' - sh 'github-release upload --user Heath123 --repo pakkit --tag v${BUILD_NUMBER} --name "pakkit-macos-x64.zip" --file out/pakkit-macos-x64.zip' - } - } - } - } - } - } - } - post { - always { - deleteDir() - } - } -}