Skip to content

Commit

Permalink
Build RPM and generate hashes when packaging.
Browse files Browse the repository at this point in the history
  • Loading branch information
LebJe committed Oct 21, 2020
1 parent 2b1ce1f commit 0262ca6
Showing 1 changed file with 163 additions and 96 deletions.
259 changes: 163 additions & 96 deletions .github/workflows/uploadAssets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@ 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: |
swift build -c release
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:
Expand All @@ -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/[email protected]
# 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/[email protected]
# 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/[email protected]
with:
name: LFSPointers
version: ${{ github.event.release.tag_name }}
arch: x86_64
format: deb
package: package.yaml
- uses: kentik/[email protected]
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/[email protected]
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/[email protected]
# 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/[email protected]
with:
name: LFSPointers
version: ${{ github.event.release.tag_name }}
arch: x86_64
format: deb
package: package.yaml
- uses: kentik/[email protected]
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 }}
```

0 comments on commit 0262ca6

Please sign in to comment.