117 lines
3.4 KiB
YAML
117 lines
3.4 KiB
YAML
name: Build-Publish
|
|
run-name: Build and publish infmap
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
matrix:
|
|
platform:
|
|
- linux/amd64
|
|
- linux/arm64
|
|
runs-on: ${{ matrix.platform }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Login to Gitea
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: gitea.jde.nz
|
|
username: DoesntMatter
|
|
password: ${{ secrets.DOCKER_PUSH_TOKEN }}
|
|
|
|
- name: Build
|
|
run: |
|
|
ARCH=$(uname -m)
|
|
docker build --provenance=false -t gitea.jde.nz/public/infmap:latest-${ARCH} ./app
|
|
|
|
- name: Publish
|
|
run: |
|
|
if [ "$GITHUB_REF" = "refs/heads/main" ]; then
|
|
ARCH=$(uname -m)
|
|
docker push gitea.jde.nz/public/infmap:latest-${ARCH}
|
|
fi
|
|
|
|
create-manifest:
|
|
needs: [build]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Login to Gitea
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: gitea.jde.nz
|
|
username: DoesntMatter
|
|
password: ${{ secrets.DOCKER_PUSH_TOKEN }}
|
|
|
|
- name: Create and push manifest list
|
|
run: |
|
|
if [ "$GITHUB_REF" = "refs/heads/main" ]; then
|
|
docker manifest rm gitea.jde.nz/public/infmap:latest 2>/dev/null || true
|
|
|
|
docker manifest create gitea.jde.nz/public/infmap:latest \
|
|
--amend gitea.jde.nz/public/infmap:latest-x86_64 \
|
|
--amend gitea.jde.nz/public/infmap:latest-aarch64
|
|
|
|
docker manifest annotate gitea.jde.nz/public/infmap:latest \
|
|
gitea.jde.nz/public/infmap:latest-x86_64 --arch amd64
|
|
|
|
docker manifest annotate gitea.jde.nz/public/infmap:latest \
|
|
gitea.jde.nz/public/infmap:latest-aarch64 --arch arm64
|
|
|
|
docker manifest push gitea.jde.nz/public/infmap:latest
|
|
|
|
echo "Manifest list created and pushed successfully"
|
|
fi
|
|
|
|
publish-template:
|
|
needs: [create-manifest]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install dropshell
|
|
run: |
|
|
curl -fsSL https://getbin.xyz/dropshell-install | bash
|
|
~/.local/bin/dropshell create-config
|
|
~/.local/bin/dropshell install
|
|
|
|
- name: Validate template
|
|
run: |
|
|
if ~/.local/bin/dropshell validate ./infmap; then
|
|
echo "Template validation passed"
|
|
else
|
|
echo "Template validation failed"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Publish template
|
|
env:
|
|
SOS_WRITE_TOKEN: ${{ secrets.SOS_WRITE_TOKEN }}
|
|
run: |
|
|
if [ "$GITHUB_REF" = "refs/heads/main" ]; then
|
|
~/.local/bin/dropshell publish --all ./
|
|
fi
|
|
|
|
- name: Publish setup script to getbin.xyz
|
|
env:
|
|
SOS_WRITE_TOKEN: ${{ secrets.SOS_WRITE_TOKEN }}
|
|
run: |
|
|
if [ "$GITHUB_REF" = "refs/heads/main" ]; then
|
|
BUILD_DATE=$(TZ=Pacific/Auckland date +"%Y-%m-%d %H:%M %Z")
|
|
sed "s|__BUILD_DATE__|${BUILD_DATE}|g" ./setup-remote.sh > /tmp/setup-remote.sh
|
|
curl -L -s -o /tmp/sos "https://getbin.xyz/sos:latest"
|
|
chmod +x /tmp/sos
|
|
/tmp/sos upload "getbin.xyz" "/tmp/setup-remote.sh" "infmap-setup:latest"
|
|
fi
|