diff --git a/.github/workflows/uploadAssets.yml b/.github/workflows/uploadAssets.yml index a04a5a6..9bb3a05 100644 --- a/.github/workflows/uploadAssets.yml +++ b/.github/workflows/uploadAssets.yml @@ -2,17 +2,16 @@ name: Build, Package, and Upload on: - release -env: - APP_NAME: 'LFSPointers' - MAINTAINER: 'LebJe' - DESC: 'A command line tool and SPM package that allows you to convert a Git repository directory of large files to Git LFS pointers.' jobs: PackageOnMacOS-x86_64: runs-on: macos-latest + outputs: + SHA: ${{ steps.build-and-package.outputs.SHA }} steps: - uses: actions/checkout@v2 - name: Build and Package + id: build-and-package env: TAG: ${{ github.event.release.tag_name }} run: | @@ -20,6 +19,8 @@ jobs: mkdir LFSPointers-$TAG-macOS-amd64 cp .build/release/LFSPointers LFSPointers-$TAG-macOS-amd64 tar -czf LFSPointers-$TAG-macOS-amd64.tar.gz LFSPointers-$TAG-macOS-amd64 + export SHA256="$(cat LFSPointers-$TAG-macOS-amd64.tar.gz | shasum -a 256 | cut -d " " -f 1)" + echo "::set-output name=SHA::$SHA256" - name: Upload Binaries uses: svenstaro/upload-release-action@v2 with: @@ -29,98 +30,164 @@ jobs: tag: ${{ github.ref }} overwrite: true body: "" - # Swift 5.3 Developer Snapshots aren't available yet. + # PackageOnUbuntu-ARM: + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v2 + # - uses: uraimo/run-on-arch-action@v1.1.0 + # id: build-and-package + # env: + # TAG: ${{ github.event.release.tag_name }} + # with: + # architecture: aarch64 + # distribution: ubuntu20.04 + # githubToken: ${{ secrets.GITHUB_TOKEN }} + # run: | + # export DEBIAN_FRONTEND=noninteractive + # apt update -q + # apt install -q -y curl sudo + # curl -s https://packagecloud.io/install/repositories/swift-arm/release/script.deb.sh | sudo bash + # apt update -q -y + # apt install -q -y swift-lang + # swift build -c release --enable-test-discovery + # rm -f LFSPointers + # cp .build/release/LFSPointers . + # mkdir LFSPointers-$TAG-linux-arm64 + # cp .build/release/LFSPointers LFSPointers-$TAG-linux-arm64 + # tar -czf LFSPointers-${{ github.event.release.tag_name }}-linux-arm64.tar.gz LFSPointers-$TAG-linux-arm64 + # - name: SetEnv + # run: | + # export SHA256=$(cat LFSPointers-$TAG-linux-arm64.tar.gz | shasum -a 256 | cut -d " " -f 1) + # echo "LINUX_AARCH64_SHA=$SHA256" >> $GITHUB_ENV + # - name: Upload Binaries + # uses: svenstaro/upload-release-action@v2 + # with: + # repo_token: ${{ secrets.GITHUB_TOKEN }} + # file: LFSPointers-${{ github.event.release.tag_name }}-linux-arm64.tar.gz + # file: LFSPointers-${{ github.event.release.tag_name }}-linux-arm64.tar.gz + # asset_name: LFSPointers-${{ github.event.release.tag_name }}-linux-arm64.tar.gz + # tag: ${{ github.ref }} + # overwrite: true + # body: "" + # - uses: kentik/pkg@v1.0.0-rc6 + # with: + # name: LFSPointers + # version: ${{ github.event.release.tag_name }} + # arch: aarch64 + # format: deb + # package: package.yaml + # - name: Hash Deb + # env: + # TAG: ${{ github.event.release.tag_name }} + # run: | + # export SHA256="$(cat LFSPointers_$TAG-arm64.deb | shasum -a 256 | cut -d " " -f 1)" + # echo "LINUX_AARCH64_SHA-DEB=$SHA256" >> $GITHUB_ENV + # - name: Upload Deb + # uses: svenstaro/upload-release-action@v2 + # with: + # repo_token: ${{ secrets.GITHUB_TOKEN }} + # file: ./*.deb + # tag: ${{ github.ref }} + # overwrite: true + # body: "" + # file_glob: true + PackageOnUbuntu-x86_64: + runs-on: ubuntu-latest + container: swiftlang/swift:nightly-5.3-focal + outputs: + SHA-TAR: ${{ steps.build-and-package.outputs.SHA-TAR }} + SHA-DEB: ${{ steps.hashDeb.outputs.SHA-DEB }} + SHA-RPM: ${{ steps.hashDeb.outputs.SHA-RPM }} + steps: + - uses: actions/checkout@v2 + - name: Build and Package + id: build-and-package + env: + TAG: ${{ github.event.release.tag_name }} + run: | + swift build -c release --enable-test-discovery --static-swift-stdlib -Xswiftc -static-executable + rm -f LFSPointers + cp .build/release/LFSPointers . + mkdir LFSPointers-$TAG-linux-amd64 + cp .build/release/LFSPointers LFSPointers-$TAG-linux-amd64 + tar -czf LFSPointers-$TAG-linux-amd64.tar.gz LFSPointers-$TAG-linux-amd64 + export SHA256="$(cat LFSPointers-$TAG-linux-amd64.tar.gz | shasum -a 256 | cut -d " " -f 1)" + echo "::set-output name=SHA-TAR::$SHA256" + - uses: kentik/pkg@v1.0.0-rc6 + with: + name: LFSPointers + version: ${{ github.event.release.tag_name }} + arch: x86_64 + format: deb + package: package.yaml + - uses: kentik/pkg@v1.0.0-rc6 + with: + name: LFSPointers + version: ${{ github.event.release.tag_name }} + arch: x86_64 + format: rpm + package: package.yaml + - name: Hash Deb + id: hashDeb + env: + TAG: ${{ github.event.release.tag_name }} + run: | + export SHA256="$(cat LFSPointers_$TAG-1_amd64.deb | shasum -a 256 | cut -d " " -f 1)" + echo "::set-output name=SHA-DEB::$SHA256" + export SHA256="$(cat LFSPointers-$TAG-1.x86_64.rpm | shasum -a 256 | cut -d " " -f 1)" + echo "::set-output name=SHA-RPM::$SHA256" + - name: Upload Deb + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./*.deb + tag: ${{ github.ref }} + overwrite: true + body: "" + file_glob: true + - name: Upload RPM + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./*.rpm + tag: ${{ github.ref }} + overwrite: true + body: "" + file_glob: true + + UpdateRelease: + needs: [PackageOnMacOS-x86_64, PackageOnUbuntu-x86_64] + runs-on: ubuntu-latest + steps: + - name: Add SHA256 + uses: tubone24/update_release@v1.1.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + body: | + # Hashes + + LFSPointers-${{ github.event.release.tag_name }}-macOS-amd64.tar.gz + + ``` + ${{ needs.PackageOnMacOS-x86_64.outputs.SHA }} + ``` + + LFSPointers-${{ github.event.release.tag_name }}-linux-amd64.tar.gz + + ``` + ${{ needs.PackageOnUbuntu-x86_64.outputs.SHA-TAR }} + ``` + + LFSPointers_${{ github.event.release.tag_name }}-1_amd64.deb + + ``` + ${{ needs.PackageOnUbuntu-x86_64.outputs.SHA-DEB }} + ``` - # PackageOnUbuntu-ARM: - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v2 - # - uses: uraimo/run-on-arch-action@v1.1.0 - # env: - # TAG: ${{ github.event.release.tag_name }} - # with: - # architecture: aarch64 - # distribution: ubuntu18.04 - # run: | - # export DEBIAN_FRONTEND=noninteractive - # apt update -q - # apt install -q -y curl sudo - # curl -s https://packagecloud.io/install/repositories/swift-arm/release/script.deb.sh | sudo bash - # apt install -q -y swift-lang - # apt update -q -y - # swift build -c release --enable-test-discovery --static-swift-stdlib -Xswiftc -static-executable - # mkdir LFSPointers-$TAG-linux-arm64 - # cp .build/release/LFSPointers LFSPointers-$TAG-linux-arm64 - # tar -czf LFSPointers-$TAG-linux-arm64.tar.gz LFSPointers-$TAG-linux-arm64 - # - name: Upload Binaries - # uses: svenstaro/upload-release-action@v2 - # with: - # repo_token: ${{ secrets.GITHUB_TOKEN }} - # file: LFSPointers-${{ github.event.release.tag_name }}-linux-arm64.tar.gz - # asset_name: LFSPointers-${{ github.event.release.tag_name }}-linux-arm64.tar.gz - # tag: ${{ github.ref }} - # overwrite: true - # body: "" - # - name: Create deb and rpm structure - # run: | - # mkdir -p .arm-debpkg/usr/bin - # mkdir -p .arm-rpmpkg/usr/bin - # cp .build/release/LFSPointers .arm-debpkg/usr/bin/ - # cp .build/release/LFSPointers .arm-rpmpkg/usr/bin/ - # - uses: jiro4989/build-deb-action@v2 - # with: - # package: ${{ env.APP_NAME }} - # package_root: .arm-debpkg - # maintainer: ${{ env.MAINTAINER }} - # version: ${{ github.ref }} - # arch: 'arm64' - # desc: '${{ env.DESC }}' - PackageOnUbuntu-x86_64: - runs-on: ubuntu-latest - container: swiftlang/swift:nightly-5.3-focal - steps: - - uses: actions/checkout@v2 - - name: Build and Package - env: - TAG: ${{ github.event.release.tag_name }} - run: | - swift build -c release --enable-test-discovery --static-swift-stdlib -Xswiftc -static-executable - rm LFSPointers - cp .build/release/LFSPointers . - mkdir LFSPointers-$TAG-linux-amd64 - cp .build/release/LFSPointers LFSPointers-$TAG-linux-amd64 - tar -czf LFSPointers-$TAG-linux-amd64.tar.gz LFSPointers-$TAG-linux-amd64 - - uses: kentik/pkg@v1.0.0-rc6 - with: - name: LFSPointers - version: ${{ github.event.release.tag_name }} - arch: x86_64 - format: deb - package: package.yaml - - uses: kentik/pkg@v1.0.0-rc6 - with: - name: LFSPointers - version: ${{ github.event.release.tag_name }} - arch: x86_64 - format: rpm - package: package.yaml - - name: Upload Deb - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./*.deb - tag: ${{ github.ref }} - overwrite: true - body: "" - file_glob: true - - name: Upload RPM - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./*.rpm - tag: ${{ github.ref }} - overwrite: true - body: "" - file_glob: true + LFSPointers_${{ github.event.release.tag_name }}-1.x86_64.rpm + ``` + ${{ needs.PackageOnUbuntu-x86_64.outputs.SHA-RPM }} + ``` \ No newline at end of file