overlayfs #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: overlayfs | |
| on: [workflow_dispatch] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| ssha: ${{ steps.ssha.outputs.ssha }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Compile and extract artifacts from docker container | |
| run: | | |
| sudo apt install jo jq | |
| mkdir -p dist | |
| for arch in x86_64; do | |
| docker build --platform "${arch}" -f overlayfs.dockerfile -t overlayfs:latest . | |
| docker run --rm --platform "${arch}" \ | |
| -v $(pwd):/workdir \ | |
| overlayfs:latest \ | |
| cp /tools/overlayfs/fuse-overlayfs "/workdir/dist/overlayfs-${arch}" | |
| SHA="$(sha256sum ./dist/overlayfs-${arch} | awk '{print $1}')" | |
| ./metadata.sh --version "$(./dist/overlayfs-${arch} --version | head -n1 | awk '{print $3}')" \ | |
| --license GPL-2.0 "https://github.com/containers/fuse-overlayfs/blob/main/COPYING" \ | |
| --source "https://github.com/containers/fuse-overlayfs" \ | |
| --sha "$SHA" > ./dist/overlayfs-metadata.json | |
| done | |
| - name: Set permissions for dist directory | |
| run: | | |
| sudo chown -R "$(id -u)":"$(id -g)" dist/ | |
| sudo chmod -R 755 dist/ | |
| - name: Upload artifacts to release | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: 'dist' | |
| - name: Compute Short SHA | |
| id: ssha | |
| run: | | |
| echo "ssha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| release: | |
| permissions: write-all | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| - name: Create release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| TAG=${GITHUB_SHA::7} | |
| # Create release if it doesn't exist; ignore error if it does | |
| gh release create "$TAG" --title "Release $TAG" --notes "Automated" --target "$GITHUB_SHA" || true | |
| # Upload/replace the asset(s) | |
| gh release upload "$TAG" overlayfs-* --clobber |