diff --git a/.github/workflows/cleanup.yaml b/.github/workflows/cleanup.yaml new file mode 100644 index 0000000..3b544a5 --- /dev/null +++ b/.github/workflows/cleanup.yaml @@ -0,0 +1,13 @@ +name: 'nightly artifacts cleanup' +on: + schedule: + - cron: '0 0 * * *' # Run at midnight + +jobs: + delete-artifacts: + runs-on: ubuntu-latest + steps: + - uses: kolpav/purge-artifacts-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + expire-in: 0 # Set this to 0 to delete all artifacts diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..354266a --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,137 @@ +name: Build NosoWallet + +on: + push: + branches: [ main ] + tags: [ "*" ] + paths-ignore: [ "README.md", "changelog.txt", "releasenotes.txt" ] + + pull_request: + branches: [ main ] + +jobs: + build: + name: Build and test + runs-on: ${{ matrix.operating-system }} + + strategy: + matrix: + operating-system: [ ubuntu-20.04, ubuntu-latest, windows-latest] + lazarus-versions: [ stable] + + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + with: + clean: true + set-safe-directory: true + + - name: Install Lazarus + uses: gcarreno/setup-lazarus@v3.2 + with: + lazarus-version: ${{ matrix.lazarus-versions }} + with-cache: false + + - name: Unzip packages + run: unzip -q Packages/\*.zip -d Packages + - name: Install packages + run: | + lazbuild -qqq Packages/Indy10/indylaz.lpk + lazbuild -qqq Packages/HashLib/src/Packages/FPC/HashLib4PascalPackage.lpk + lazbuild -qqq Packages/SimpleBaseLib/src/Packages/FPC/SimpleBaseLib4PascalPackage.lpk + lazbuild -qqq Packages/dcpcrypt-2.0.4.1/dcpcrypt.lpk + lazbuild -qqq Packages/CryptoLib4Pascal-master/CryptoLib/src/Packages/FPC/CryptoLib4PascalPackage.lpk + lazbuild -qqq Packages/lazbarcodes/packages/lazbarcodes_runtimeonly.lpk + lazbuild -qqq Packages/lazbarcodes/packages/lazbarcodes.lpk + + - name: Build the Main App (Windows) + if: ${{ matrix.operating-system == 'windows-latest' }} + run: | + lazbuild -B --bm=Release "Noso.lpi" + + - name: Build the Main App (Ubuntu) + if: ${{ matrix.operating-system == 'ubuntu-latest' }} + run: | + lazbuild -B --bm=Release "Noso.lpi" + + - name: Build the Main App (Ubuntu) + if: ${{ matrix.operating-system == 'ubuntu-20.04' }} + run: | + lazbuild -B --bm=Release "Noso.lpi" + + - name: Upload binary (Windows) + if: ${{ (matrix.operating-system == 'windows-latest') && (matrix.lazarus-versions == 'stable') }} + uses: actions/upload-artifact@v2 + with: + name: noso-windows + path: Noso.exe + + - name: Upload binary (Ubuntu) + if: ${{ (matrix.operating-system == 'ubuntu-latest') && (matrix.lazarus-versions == 'stable') }} + uses: actions/upload-artifact@v2 + with: + name: noso-linuxnew + path: Noso + + - name: Upload binary (Ubuntu) + if: ${{ (matrix.operating-system == 'ubuntu-20.04') && (matrix.lazarus-versions == 'stable') }} + uses: actions/upload-artifact@v2 + with: + name: noso-linux + path: Noso + + package-release: + if: contains(github.ref, '/tags/') + + name: Package and create GitHub Release + runs-on: ubuntu-latest + needs: build + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set output + id: vars + run: echo "tag=${GITHUB_REF#refs/*/}" >> ${GITHUB_OUTPUT} + + - name: Download the Release binary + uses: actions/download-artifact@v2 + + - name: List files + run: | + ls -al + ls -al noso-windows + ls -al noso-linuxnew + ls -al noso-linux + + - name: Package Windows + run: | + cp noso-windows/Noso.exe . + tag=${{ github.event.ref }} + tag=${tag#"refs/tags/"} + zip noso-${tag}-x86_64-win64.zip Noso.exe + - name: Package Ubuntu latest + run: | + cp noso-linuxnew/Noso . + tag=${{ github.event.ref }} + tag=${tag#"refs/tags/"} + chmod +x Noso + tar -zcvf noso-${tag}-x86_64-linuxnew.tgz Noso + zip -r noso-${tag}-x86_64-linuxnew.zip Noso + - name: Package Ubuntu 20.04 + run: | + cp noso-linux/Noso . + tag=${{ github.event.ref }} + tag=${tag#"refs/tags/"} + chmod +x Noso + tar -zcvf noso-${tag}-x86_64-linux.tgz Noso + zip -r noso-${tag}-x86_64-linux.zip Noso + - name: Upload Release + uses: softprops/action-gh-release@v1 + with: + files: | + noso-*.zip + noso-*.tgz + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}