|
| 1 | +name: dwarfs_aio |
| 2 | +on: [workflow_dispatch] |
| 3 | + |
| 4 | +jobs: |
| 5 | + build: |
| 6 | + runs-on: ubuntu-latest |
| 7 | + outputs: |
| 8 | + ssha: ${{ steps.ssha.outputs.ssha }} |
| 9 | + steps: |
| 10 | + - name: Checkout code |
| 11 | + uses: actions/checkout@v4 |
| 12 | + |
| 13 | + - name: Set up QEMU |
| 14 | + uses: docker/setup-qemu-action@v3 |
| 15 | + |
| 16 | + - name: Compile and extract artifacts from docker container |
| 17 | + run: | |
| 18 | + mkdir -p dist |
| 19 | + # for arch in x86_64; do |
| 20 | + # docker build --platform "${arch}" -f dwarfs.dockerfile -t dwarfs:latest . |
| 21 | + # docker run --rm --platform "${arch}" \ |
| 22 | + # -v $(pwd):/workdir \ |
| 23 | + # dwarfs:latest \ |
| 24 | + # cp /dist/dwarfs "/workdir/dist/dwarfs-${arch}" |
| 25 | + # sha256sum ./dist/dwarfs-${arch} | awk '{print $1}' > ./dist/dwarfs-${arch}.sha256sum |
| 26 | + # done |
| 27 | + # Just copy the pre-built for now |
| 28 | + for arch in x86_64; do |
| 29 | + wget -O ./dist/dwarfs_aio-${arch} https://github.com/mhx/dwarfs/releases/download/v0.13.0/dwarfs-universal-0.13.0-Linux-${arch} |
| 30 | + sha256sum ./dist/dwarfs_aio-${arch} | awk '{print $1}' > ./dist/dwarfs_aio-${arch}.sha256sum |
| 31 | + done |
| 32 | +
|
| 33 | + - name: Set permissions for dist directory |
| 34 | + run: | |
| 35 | + sudo chown -R "$(id -u)":"$(id -g)" dist/ |
| 36 | + sudo chmod -R 755 dist/ |
| 37 | +
|
| 38 | + - name: Upload artifacts to release |
| 39 | + uses: actions/upload-artifact@v4 |
| 40 | + with: |
| 41 | + name: dist |
| 42 | + path: 'dist' |
| 43 | + |
| 44 | + - name: Compute Short SHA |
| 45 | + id: ssha |
| 46 | + run: | |
| 47 | + echo "ssha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT |
| 48 | +
|
| 49 | +
|
| 50 | + release: |
| 51 | + permissions: write-all |
| 52 | + needs: [build] |
| 53 | + runs-on: ubuntu-latest |
| 54 | + steps: |
| 55 | + - name: Checkout code |
| 56 | + uses: actions/checkout@v4 |
| 57 | + - name: Download artifacts |
| 58 | + uses: actions/download-artifact@v4 |
| 59 | + with: |
| 60 | + name: dist |
| 61 | + - name: Create release |
| 62 | + env: |
| 63 | + GH_TOKEN: ${{ github.token }} |
| 64 | + run: | |
| 65 | + TAG=${GITHUB_SHA::7} |
| 66 | + # Create release if it doesn't exist; ignore error if it does |
| 67 | + gh release create "$TAG" --title "Release $TAG" --notes "Automated" --target "$GITHUB_SHA" || true |
| 68 | + # Upload/replace the asset(s) |
| 69 | + gh release upload "$TAG" dwarfs_aio-* --clobber |
0 commit comments