summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yml77
1 files changed, 77 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..0a5aadb
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,77 @@
+name: Banner Container (Rust)
+on:
+ push:
+ tags:
+ - 'v/**'
+ branches:
+ - main
+ - main-next
+ workflow_dispatch:
+
+env:
+ IMAGE_NAME: banner-rs
+ IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
+ REGISTRY_USER: ${{ github.actor }}
+ REGISTRY_PASSWORD: ${{ github.token }}
+
+jobs:
+ build-and-push:
+ name: Build and push image
+ runs-on: ubuntu-latest
+
+ permissions:
+ contents: read
+ packages: write
+ attestations: write
+ id-token: write
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v5
+
+ - name: Install QEMU dependency
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y qemu-user-static
+
+ - name: Determine tags
+ id: tags
+ run: |
+ TAGS="${{ github.sha }}"
+
+ if [[ "${{ github.ref }}" == refs/tags/v/* ]]; then
+ VERSION="${{ github.ref_name }}"
+ VERSION="${VERSION#v/}"
+ TAGS="${VERSION} latest ${TAGS}"
+ fi
+
+ echo "tags=${TAGS}" >> $GITHUB_OUTPUT
+ echo "Generated tags: ${TAGS}"
+
+ - name: Build image
+ id: build_image
+ uses: redhat-actions/buildah-build@v2
+ with:
+ image: ${{ env.IMAGE_NAME }}
+ tags: ${{ steps.tags.outputs.tags }}
+ archs: amd64, arm64
+ containerfiles: |
+ ./Containerfile
+ labels: |
+ org.opencontainers.image.source=https://github.com/${{ github.repository }}
+ org.opencontainers.image.description=Banner server
+ org.opencontainers.image.licenses=MIT
+
+ - name: Push to GHCR
+ uses: redhat-actions/push-to-registry@v2
+ id: push
+ with:
+ image: ${{ steps.build_image.outputs.image }}
+ tags: ${{ steps.build_image.outputs.tags }}
+ registry: ${{ env.IMAGE_REGISTRY }}
+ username: ${{ env.REGISTRY_USER }}
+ password: ${{ env.REGISTRY_PASSWORD }}
+
+ - name: Echo outputs
+ run: |
+ echo "${{ toJSON(steps.push.outputs) }}"